@arcgis/core 5.0.0-next.44 → 5.0.0-next.46
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/063045ac5553e91c0c4c.js +1 -0
- package/assets/esri/core/workers/chunks/{20ad34f9d45c64392022.js → 08c1ea29678da27136f3.js} +1 -1
- package/assets/esri/core/workers/chunks/{5dc2f2e28c30386efadf.js → 10094eb2b94e98dd4a8a.js} +1 -1
- package/assets/esri/core/workers/chunks/169be08394c5e7703628.js +1 -0
- package/assets/esri/core/workers/chunks/1a6f3531ef3d671e0289.js +1 -0
- package/assets/esri/core/workers/chunks/{b809d499ff050976d9ed.js → 1c58064ea80e6a4a4a3b.js} +1 -1
- package/assets/esri/core/workers/chunks/1c816aff8613d1e4bf38.js +1 -0
- package/assets/esri/core/workers/chunks/{ee67c8a7c1f8b482cd99.js → 1ced78750c61600b2d4e.js} +1 -1
- package/assets/esri/core/workers/chunks/{98175b454e807b1a3c5f.js → 1e152a34e368bd810a0f.js} +1 -1
- package/assets/esri/core/workers/chunks/1e17ad6cdffa5016a3db.js +1 -0
- package/assets/esri/core/workers/chunks/1e2d42e9984ed3437ba2.js +1 -0
- package/assets/esri/core/workers/chunks/2008b22f76071a2dde4e.js +1 -0
- package/assets/esri/core/workers/chunks/2107c93d1fe87f3b8dfa.js +1 -0
- package/assets/esri/core/workers/chunks/2209550b6510e25da375.js +1 -0
- package/assets/esri/core/workers/chunks/229e1ed4282005aa0b83.js +1 -0
- package/assets/esri/core/workers/chunks/22b8eaa6afab0e5ffc47.js +1 -0
- package/assets/esri/core/workers/chunks/{1c0fb4795a52204882a8.js → 2550d2ba935cfdf30236.js} +1 -1
- package/assets/esri/core/workers/chunks/{49e6219dd08cb6c27023.js → 273ac1066095d63d6a6f.js} +1 -1
- package/assets/esri/core/workers/chunks/2e2867bc66c94aba7dc7.js +1 -0
- package/assets/esri/core/workers/chunks/{cda5c95fd49b8901f7d4.js → 3298e96d3f2e49e338d2.js} +1 -1
- package/assets/esri/core/workers/chunks/34613b288cf174983f8b.js +1 -0
- package/assets/esri/core/workers/chunks/{e5baa30944061418cb13.js → 35f086a2ae0585348ae6.js} +1 -1
- package/assets/esri/core/workers/chunks/{f441fc74451330384fb0.js → 37ea150dec5e491f691e.js} +1 -1
- package/assets/esri/core/workers/chunks/3c94db7ecdcd38eeb1b1.js +1 -0
- package/assets/esri/core/workers/chunks/3f7749f06ae54a4437d9.js +1 -0
- package/assets/esri/core/workers/chunks/40a722933af28823953b.js +1 -0
- package/assets/esri/core/workers/chunks/{7aa730e5ac7b268e3c98.js → 424daef7b5dec1b99aba.js} +1 -1
- package/assets/esri/core/workers/chunks/456684b1c1417ed0e611.js +1 -0
- package/assets/esri/core/workers/chunks/{d14e75b160aa432233c6.js → 461093ce28ceadd7853d.js} +1 -1
- package/assets/esri/core/workers/chunks/4a48b8ec5f3f2fd139b5.js +1 -0
- package/assets/esri/core/workers/chunks/4b084f985bc4100e7aec.js +1 -0
- package/assets/esri/core/workers/chunks/4b1de1fcd13677b615a8.js +1 -0
- package/assets/esri/core/workers/chunks/{31186e83fe009aa0fd36.js → 4d933de84afb2e3b7d18.js} +1 -1
- package/assets/esri/core/workers/chunks/{83aa39fbb1fad3b9d143.js → 4ff771942531fb2755c4.js} +1 -1
- package/assets/esri/core/workers/chunks/{e0017c6739d2532793e6.js → 513a4ef960e27500f986.js} +1 -1
- package/assets/esri/core/workers/chunks/56b693baa376bb990925.js +1 -0
- package/assets/esri/core/workers/chunks/{1d4ea8db272655c0608c.js → 57fd5e1260269002d18a.js} +1 -1
- package/assets/esri/core/workers/chunks/5fe40bb0e9ab333f6854.js +1 -0
- package/assets/esri/core/workers/chunks/{b56c07c0b43cb1999070.js → 60362c5651ef41fa7e5f.js} +1 -1
- package/assets/esri/core/workers/chunks/{e8a9971c8354569cb81d.js → 609919428305d8c8c243.js} +1 -1
- package/assets/esri/core/workers/chunks/{ab88577987cf2fe1cb32.js → 61373d2fa7e7638d3395.js} +1 -1
- package/assets/esri/core/workers/chunks/6202922b1c2637e9aaa5.js +1 -0
- package/assets/esri/core/workers/chunks/633368ae6fbb46373328.js +1 -0
- package/assets/esri/core/workers/chunks/6d702cb26cef46a76963.js +1 -0
- package/assets/esri/core/workers/chunks/{35272810c2ed04eb403d.js → 6f3943bebe2d5f4994f7.js} +1 -1
- package/assets/esri/core/workers/chunks/708aba69a1870ea41a61.js +1 -0
- package/assets/esri/core/workers/chunks/{7ba13b52fce1060fbb2a.js → 7147fc7502b385b302b2.js} +1 -1
- package/assets/esri/core/workers/chunks/{9ba8a2e1c0fb4e1efc7c.js → 7364fb5e99933533890d.js} +1 -1
- package/assets/esri/core/workers/chunks/74b1028e95f7cfff387b.js +1 -0
- package/assets/esri/core/workers/chunks/78fccea3445fb2f9120a.js +1 -0
- package/assets/esri/core/workers/chunks/7ba31425caa404f86424.js +1 -0
- package/assets/esri/core/workers/chunks/{040f3d8e1099c4843390.js → 81a60dfa600b690098f9.js} +1 -1
- package/assets/esri/core/workers/chunks/833fd2bc42c5cb459084.js +1 -0
- package/assets/esri/core/workers/chunks/{75643711d9585ee26a15.js → 83c8e5a92d8d6193cb32.js} +1 -1
- package/assets/esri/core/workers/chunks/{e537e1d37f3fcb14fce2.js → 870022661376442411e4.js} +1 -1
- package/assets/esri/core/workers/chunks/898ab7db220e81e921c6.js +1 -0
- package/assets/esri/core/workers/chunks/{31b074ae2162a3508d2a.js → 8b578ffc3a83089aa782.js} +1 -1
- package/assets/esri/core/workers/chunks/{48c8ef4170e803a564d6.js → 8b75861196d1ce5cba63.js} +1 -1
- package/assets/esri/core/workers/chunks/8be61e13530fd0dc2fd1.js +1 -0
- package/assets/esri/core/workers/chunks/90b8ccee883738917a6d.js +1 -0
- package/assets/esri/core/workers/chunks/90bc9c299ae0e8b8b5e5.js +1 -0
- package/assets/esri/core/workers/chunks/91d9ade78854f40a962d.js +1 -0
- package/assets/esri/core/workers/chunks/{74881340e040bfd0580f.js → 934bc1028b287f8df4aa.js} +1 -1
- package/assets/esri/core/workers/chunks/96055de47831e59a28bf.js +1 -0
- package/assets/esri/core/workers/chunks/963ba863e0f87abfca25.js +1 -0
- package/assets/esri/core/workers/chunks/9aa8d60483ad905fe13b.js +1 -0
- package/assets/esri/core/workers/chunks/9fed9946241bb2a5cfa4.js +1 -0
- package/assets/esri/core/workers/chunks/a2662e98857f0abf8e82.js +1 -0
- package/assets/esri/core/workers/chunks/a5a9b0a35849b9f2e86d.js +1 -0
- package/assets/esri/core/workers/chunks/a60006c9ccf6817fc0d2.js +1 -0
- package/assets/esri/core/workers/chunks/a627b7eb94b7fca33210.js +1 -0
- package/assets/esri/core/workers/chunks/a651dc3b8f1fc1ab34cc.js +1 -0
- package/assets/esri/core/workers/chunks/aab93e885b6c7c6aa76e.js +316 -0
- package/assets/esri/core/workers/chunks/adfe28c1c1619cdd3ca1.js +1019 -0
- package/assets/esri/core/workers/chunks/b88dc7d8ae105747e6a4.js +1 -0
- package/assets/esri/core/workers/chunks/b90c786dd474ea1a409c.js +1 -0
- package/assets/esri/core/workers/chunks/b92e9e5df8154a128982.js +1 -0
- package/assets/esri/core/workers/chunks/{9a855a10798348a21bab.js → bff814d34b38ec80c44d.js} +1 -1
- package/assets/esri/core/workers/chunks/c36d699a75b6e8fb93eb.js +1 -0
- package/assets/esri/core/workers/chunks/c50fdf723f2d4316862e.js +1 -0
- package/assets/esri/core/workers/chunks/{9461cc37ab3397265270.js → c5e8ff4721b15ac3c6eb.js} +1 -1
- package/assets/esri/core/workers/chunks/{4cda42b94e9cb58dd372.js → ca61077e0a598654f33f.js} +1 -1
- package/assets/esri/core/workers/chunks/{61a9ffd4cf07d8bb7a9b.js → ca81be5bdb88ef557bf3.js} +1 -1
- package/assets/esri/core/workers/chunks/{ca1c65eb7f5900c60170.js → cd8fec3500e6503ae020.js} +1 -1
- package/assets/esri/core/workers/chunks/ce90e8489143228262e7.js +1 -0
- package/assets/esri/core/workers/chunks/d0320ca67abca4f8b0d2.js +1 -0
- package/assets/esri/core/workers/chunks/{4b6a44c6265c8959abd8.js → d3db7244fac7398cc700.js} +1 -1
- package/assets/esri/core/workers/chunks/{19820cddba13a3585c0b.js → d561624ddb9388732b25.js} +1 -1
- package/assets/esri/core/workers/chunks/d65ca3b8fccae8c3c3fa.js +1 -0
- package/assets/esri/core/workers/chunks/{630eba99f48ea79a9560.js → d705410c369bd03b1875.js} +1 -1
- package/assets/esri/core/workers/chunks/{9c7682b300b877f60095.js → d76513a6260d9ec4ea25.js} +1 -1
- package/assets/esri/core/workers/chunks/{7c08c0824ad354177787.js → d7878fba02814adaf19f.js} +1 -1
- package/assets/esri/core/workers/chunks/d82e17522ed946c2d809.js +1 -0
- package/assets/esri/core/workers/chunks/d8dc130ea559be1f68c6.js +1 -0
- package/assets/esri/core/workers/chunks/{768ae52b4e5c3e571ef5.js → dc29cb16704e2e4d0a46.js} +1 -1
- package/assets/esri/core/workers/chunks/e8c2e2fbe9cef4c8a8c6.js +1 -0
- package/assets/esri/core/workers/chunks/{3f33708eb39c7169a226.js → f2ba50eb29f93df885d6.js} +1 -1
- package/assets/esri/core/workers/chunks/{6e5d41f51572e3e7cf92.js → f7163048146ddaedfc36.js} +1 -1
- package/assets/esri/core/workers/chunks/fdaa10a588db394e2f65.js +1 -0
- package/chunks/GaussianSplat.glsl.js +2 -2
- package/chunks/Laserlines.glsl.js +1 -1
- package/chunks/boundedPlane.js +1 -1
- package/chunks/cameraUtilsSpherical.js +1 -1
- package/chunks/vec32.js +1 -1
- package/config.js +1 -1
- package/core/libs/gl-matrix-2/math/quat.js +1 -1
- package/core/libs/gl-matrix-2/math/vec3.js +1 -1
- package/core/urlUtils.d.ts +1 -0
- package/core/workers/workerFactory.js +1 -1
- package/geometry/FlatGeometry.js +1 -1
- package/geometry/operators/support/apiConverter.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/support/curves/circleUtils.js +1 -1
- package/geometry/support/lineSegment.js +1 -1
- package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
- package/geometry/support/meshUtils/merge.js +1 -1
- package/geometry/support/sphere.js +1 -1
- package/interfaces.d.ts +148 -21
- package/kernel.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/orientedImagery/transformations/worldToImage.js +1 -1
- package/layers/support/tiles3DUtils.js +1 -1
- package/layers/voxel/VoxelVolume.js +1 -1
- package/package.json +2 -2
- package/rest/print.js +1 -1
- package/rest/support/LegendLayer.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/effects/EffectSuppress.js +1 -1
- package/views/2d/interactive/SegmentLabels2D.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/animation/pointToPoint/Camera.js +1 -1
- package/views/3d/camera/constraintUtils/distance.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/CloudsParameters.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/glTF/internal/Resource.js +1 -1
- package/views/3d/glTF/loader.js +1 -1
- package/views/3d/interactive/SegmentLabels3D.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
- package/views/3d/interactive/editingTools/media/MediaElementManipulator3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
- package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/IconSymbolLayerRenderer.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/state/Frustum.js +1 -1
- package/views/3d/state/controllers/FovController.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
- package/views/3d/support/FrustumExtentIntersection.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/intersectionUtils.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/webgl/RenderCamera.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
- package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
- package/views/3d/webgl-engine/lib/triangleIntersectionUtils.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/pbrUtils.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerOriginData.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatColorTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/GaussianSplatDepthTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/interactive/GraphicManipulator.js +1 -1
- package/views/interactive/coordinateHelper.js +1 -1
- package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
- package/views/interactive/sketch/constraints.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
- package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
- package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
- package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
- package/views/support/euclideanAreaMeasurementUtils.js +1 -1
- package/views/support/euclideanLengthMeasurementUtils.js +1 -1
- package/views/support/geometry3dUtils.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/css.js +1 -1
- package/widgets/BatchAttributeForm/inputs/SingleFeatureInput.d.ts +4 -0
- package/widgets/BatchAttributeForm/inputs/SingleFeatureInput.js +5 -0
- package/widgets/BatchAttributeForm/inputs/TextElementInput.d.ts +4 -0
- package/widgets/BatchAttributeForm/inputs/TextElementInput.js +5 -0
- package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm/templates/GroupElementTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/TextElementTemplate.js +5 -0
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/templateUtils.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/FeatureForm/TextElementInput.d.ts +2 -2
- package/widgets/FeatureTable/AttachmentsColumn.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Column.js +1 -1
- package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicZoomManager.js +1 -1
- package/widgets/PanoramicViewer/support/PanoramicMedia.js +5 -0
- package/widgets/PanoramicViewer/support/PanoramicMediaCollection.js +5 -0
- package/widgets/PanoramicViewer/support/PanoramicMediaError.js +5 -0
- package/widgets/PanoramicViewer/utils.js +1 -1
- package/widgets/PanoramicViewer.js +1 -1
- package/widgets/Print/CustomTemplate.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Print/TemplateOptions.js +1 -1
- package/widgets/Print.js +1 -1
- package/assets/esri/core/workers/chunks/04a0685ee53ef74883aa.js +0 -1
- package/assets/esri/core/workers/chunks/1e0e7cef7ef947894bbe.js +0 -1019
- package/assets/esri/core/workers/chunks/20988e116f3723228f36.js +0 -1
- package/assets/esri/core/workers/chunks/2613e482450b57f2d4f5.js +0 -1
- package/assets/esri/core/workers/chunks/274f2b5e6dbc58505142.js +0 -1
- package/assets/esri/core/workers/chunks/27dfbe3d903b95d4c67a.js +0 -1
- package/assets/esri/core/workers/chunks/28a5a7c6b3d6902146f6.js +0 -1
- package/assets/esri/core/workers/chunks/2c4218306747f5d15575.js +0 -1
- package/assets/esri/core/workers/chunks/2db7a7607657f1d669f7.js +0 -1
- package/assets/esri/core/workers/chunks/3767617c0dfc7d801441.js +0 -1
- package/assets/esri/core/workers/chunks/44b6b7418cbf7f778bef.js +0 -1
- package/assets/esri/core/workers/chunks/4675ed3ca3e0104d00bf.js +0 -1
- package/assets/esri/core/workers/chunks/4df7cc3477bc46fc39af.js +0 -1
- package/assets/esri/core/workers/chunks/538ddb267aa328814865.js +0 -1
- package/assets/esri/core/workers/chunks/555a0ea44ba77819d493.js +0 -1
- package/assets/esri/core/workers/chunks/55818fe7a7aa1e5c8bbd.js +0 -1
- package/assets/esri/core/workers/chunks/5f781ef46ce7c4048c2f.js +0 -1
- package/assets/esri/core/workers/chunks/60f2de8dd8876bfd715a.js +0 -1
- package/assets/esri/core/workers/chunks/679088064420a906aa7f.js +0 -1
- package/assets/esri/core/workers/chunks/706423d801fa9cbf2e90.js +0 -1
- package/assets/esri/core/workers/chunks/71dd80231ea656a6380c.js +0 -1
- package/assets/esri/core/workers/chunks/725819839434c59102f3.js +0 -1
- package/assets/esri/core/workers/chunks/72cebf18da5ec5eeb666.js +0 -1
- package/assets/esri/core/workers/chunks/768d9b6eaba7bfa18dde.js +0 -1
- package/assets/esri/core/workers/chunks/77b45957cfe42523c1c8.js +0 -1
- package/assets/esri/core/workers/chunks/852de585a72d902344a6.js +0 -1
- package/assets/esri/core/workers/chunks/871dd5e1f016a04b8d98.js +0 -1
- package/assets/esri/core/workers/chunks/892c417f5130b003889d.js +0 -1
- package/assets/esri/core/workers/chunks/907083c427d7fb4354e9.js +0 -1
- package/assets/esri/core/workers/chunks/93c5f097bb7b380bb175.js +0 -1
- package/assets/esri/core/workers/chunks/9f0172b83f25ef5f8d40.js +0 -1
- package/assets/esri/core/workers/chunks/ae793d814cf32db9fbde.js +0 -1
- package/assets/esri/core/workers/chunks/b21cf62652ca772108c8.js +0 -1
- package/assets/esri/core/workers/chunks/c5c02ace54fe4ab9214b.js +0 -1
- package/assets/esri/core/workers/chunks/c82a974c8448407885e6.js +0 -1
- package/assets/esri/core/workers/chunks/d08ee45c501102deea20.js +0 -1
- package/assets/esri/core/workers/chunks/d239a4ef60e348cfb05a.js +0 -1
- package/assets/esri/core/workers/chunks/da2ba40bc017bff0fe49.js +0 -1
- package/assets/esri/core/workers/chunks/dc3a4ad62bc041a4f899.js +0 -1
- package/assets/esri/core/workers/chunks/e093e745708f722bc1b9.js +0 -1
- package/assets/esri/core/workers/chunks/e501d68a1464805c4b4e.js +0 -1
- package/assets/esri/core/workers/chunks/ea3cba01c60d9bc72719.js +0 -316
- package/assets/esri/core/workers/chunks/f3c232fc56a29d51196a.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../Camera.js";import i from"../../Ground.js";import o from"../../Map.js";import a from"../../core/Collection.js";import r from"../../core/Error.js";import{EventedAccessor as s}from"../../core/Evented.js";import{JSONMap as n}from"../../core/jsonMap.js";import d from"../../core/Logger.js";import{rad2deg as h,deg2rad as l}from"../../core/mathUtils.js";import{destroyMaybe as m}from"../../core/maybe.js";import{waitTick as c}from"../../core/promiseUtils.js";import{watch as p,syncAndInitial as g,when as u,whenOnce as v}from"../../core/reactiveUtils.js";import{property as _,subclass as y}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import w from"../../geometry/SpatialReference.js";import V from"../../layers/GraphicsLayer.js";import{convertSphereVertexToPixelLocation as M}from"../../layers/orientedImagery/transformations/utils.js";import R from"../../views/SceneView.js";import{fixedImageSize as P}from"../OrientedImageryViewer/constants.js";import{logAndThrow as z,getMissingPropertyErrorName as H,getMissingPropertyErrorMessage as b}from"../OrientedImageryViewer/utils.js";import{defaultImageSphereCenter as F,maxPanoramicViewerHFOV as C,minPanoramicViewerHFOV as S,humanBinocularHFOV as O}from"./constants.js";import j from"./PanoramicZoomConditions.js";import I from"./PanoramicZoomViewModel.js";import{findDiagonalFOV as x,meshToGraphic as L,createImageSphere as k}from"./utils.js";import{enumeration as A}from"../../core/accessorSupport/decorators/enumeration.js";const G={default:"default",navigation:"navigation",fovConstraint:"fov-constraint",clickAction:"image-click-action"};let T=class extends s{constructor(e){super(e),this._startPosition=null,this._targetPosition=null,this._graphics=new V({elevationInfo:{mode:"relative-to-ground"}}),this._imageGraphic=null,this._loadController=null,this._map=new o({ground:new i({opacity:0,navigationConstraint:null}),layers:new a([this._graphics])}),this._zoomViewModel=null,this.autoLoad=!1,this.clickAction="none",this.closestFeature=null,this.currentTime=0,this.imageSize=null,this.oiViewModel=null,this.videoSource=null,this.videoDuration=void 0,this.videoLoaded=!1,this.videoPaused=null,this.videoMuted=null,this.pitch=90,this.state="ready",this.updatingHandles=new f,this.video=null,this.yaw=0,this._addNavigationHandles=()=>{this.imageRenderer.basemapTerrain.suspended=!0,this.imageRenderer.constraints.tilt.max=180,this.removeHandles(G.navigation),this.addHandles([this.imageRenderer.on("mouse-wheel",this._handleWheel),this.imageRenderer.on("double-click",this._handleDoubleClick),this.imageRenderer.on("drag",this._handleDrag),this.imageRenderer.on("key-down",e=>{const t=["+","-","Shift","_","=","ArrowUp","ArrowDown","ArrowRight","ArrowLeft"],i=e.key;t.includes(i)&&e.stopPropagation()})],G.navigation)},this._addHFOVHandles=()=>{this.removeHandles(G.fovConstraint),this.addHandles(p(()=>[this.maxHFOV,this.minHFOV],()=>{this._zoomViewModel&&(this._zoomViewModel.panoramicZoomConditions=new j({view:this.imageRenderer,maxFOV:this.maxHFOV,minFOV:this.minHFOV}))},g),G.fovConstraint)},this._addZoomHandles=()=>{this._zoomViewModel=new I({view:this.imageRenderer,panoramicZoomConditions:new j({maxFOV:this.maxHFOV,minFOV:this.minHFOV})});const e=this.imageRenderer.ui.find("zoom");e&&(e.viewModel=this._zoomViewModel),this._addHFOVHandles()},this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._handleDoubleClick=e=>{e.stopPropagation(),e.native.ctrlKey?this._zoomOut():this._zoomIn()},this._handleDrag=e=>{e.stopPropagation();const{action:t,x:i,y:o}=e;switch(t){case"start":this._startPosition=this._targetPosition={x:i,y:o};break;case"update":this._targetPosition={x:i,y:o},this._updateCameraHeadingAndTilt()}},this._handleImageClick=e=>{if("image-loaded"===this.state&&this.imageRenderer.ready)switch(this.clickAction){case"emit":e.stopPropagation(),this.emit("click",e);break;case"hittest":e.stopPropagation(),e.defer(async()=>{const t=await this.imageRenderer.hitTest(e.screenPoint,{include:this._graphics});t.results=t.results.filter(e=>"graphic"===e.type&&e.graphic!==this._imageGraphic),this.emit("hittest-response",t)});break;case"pixel-location":{if(e.stopPropagation(),!this.imageSize||!e.mapPoint)return void this.emit("pixel-location",null);const t=M(e.mapPoint,this.imageSize[0],this.imageSize[1]);this.emit("pixel-location",{...t,spatialReference:w.WebMercator});break}}},this._handleWheel=e=>{const t=e.deltaX??e.native.deltaX;e.stopPropagation(),t>0||e.deltaY>0?this._zoomOut():this._zoomIn()},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadVideo(this._loadController)},this._zoomIn=()=>this._zoomViewModel?.zoomIn(),this._zoomOut=()=>this._zoomViewModel?.zoomOut(),this.addGraphic=(e,t)=>"image-loaded"===this.state&&!this._graphics.graphics.includes(e)&&(this._graphics.graphics.add(e,t),!0),this.addManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const t=e.filter(e=>!this._graphics.graphics.includes(e));return this._graphics.graphics.addMany(t),!0},this.clearGraphics=()=>{this._graphics.graphics.removeAll()},this.clearImage=()=>{this.imageSize=null,this._removeImageSphere()},this.enableAudio=()=>{const{video:e}=this;e&&(e.muted=!1,this.videoMuted=!1)},this.removeGraphic=e=>!("image-loaded"!==this.state||!this._graphics.graphics.includes(e))&&(this._graphics.remove(e),!0),this.removeManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const t=e.filter(e=>this._graphics.graphics.includes(e));return this._graphics.removeMany(t),!0},this.togglePanoramicAudio=()=>{if(this.video){const e=this.video.muted;this.video.muted=!e,this.videoMuted=!e}},this._imageRenderer=new R({map:this._map,viewingMode:"local",camera:{position:F},environment:{atmosphereEnabled:!1,starsEnabled:!1,lighting:{type:"virtual"}},popupEnabled:!1,spatialReference:w.WebMercator,attributionVisible:!1,ui:{components:["zoom"]}})}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([p(()=>this.videoSource,()=>{this.videoSource&&this.autoLoad&&this._loadWithController()},g),p(()=>this.fov,()=>{this._reloadCamera()},g),p(()=>this.yaw,e=>{this.camera&&(this.camera.heading=e,this._reloadCamera())},g),p(()=>this.pitch,e=>{this.camera&&(this.camera.tilt=e,this._reloadCamera())},g),u(()=>this.imageRenderer.ready,()=>{this._addNavigationHandles(),this._addZoomHandles()},g),p(()=>this.clickAction,e=>{this.removeHandles(G.clickAction),"none"!==e&&this.addHandles(this.imageRenderer.on("click",this._handleImageClick))},g),p(()=>this.video,e=>{if(e instanceof HTMLVideoElement){this._startVideo();const t=async()=>{this.currentTime=Number(e.currentTime.toFixed(2)),e.currentTime&&await this._updateVidFootprint(e.currentTime)};e.addEventListener("timeupdate",t),e.addEventListener("play",()=>this._updateVideoIcon(e.paused)),e.addEventListener("pause",()=>this._pauseVideoHandler(e))}},g)],G.default)}get camera(){return this.imageRenderer.destroying||this.imageRenderer.destroyed?null:this.imageRenderer.camera}set camera(e){!e||this.imageRenderer.destroying||this.imageRenderer.destroyed||(this.imageRenderer.camera=e.clone())}get fov(){return this.camera?.fov}set fov(e){Number.isFinite(e)&&this._zoomViewModel?.zoomTo(e)}get hfov(){if(!this.camera||!this.imageRenderer?.ready)return null;const{fov:e}=this.camera,{size:[t,i]}=this.imageRenderer,o=t/i,a=Math.atan(o);return 2*h(Math.atan(Math.tan(l(e/2))*Math.sin(a)))}get imageRenderer(){return this._imageRenderer}get maxHFOV(){const{size:[e,t]}=this.imageRenderer;return this.imageRenderer.ready?x(C,e/t):C}get minHFOV(){const{size:[e,t]}=this.imageRenderer;return this.imageRenderer.ready?x(S,e/t):S}get updating(){return this.updatingHandles.updating}get vfov(){if(!this.camera||!this.imageRenderer?.ready)return null;const{fov:e}=this.camera,{size:[t,i]}=this.imageRenderer,o=t/i,a=Math.atan(o);return 2*h(Math.atan(Math.tan(l(e/2))*Math.cos(a)))}async _loadVideoInternal(e,t){return this.state="image-loading",this.video=document.createElement("video"),this.video.src=e,this.video.addEventListener("loadedmetadata",()=>{this._setVideoDuration(),this.videoLoaded=!0}),this._updateImageSphere(this.video,t)}_pauseVideoHandler(e){this._updateVideoIcon(e.paused)}_setVideoDuration(){const{video:e}=this;e?.duration&&(this.videoDuration=e.duration)}_startVideo(){try{this.enableAudio();const e=this.oiViewModel.currentBestFeature;e&&this.playPanoramicVideoFromSelectedLocation(e)}catch(e){d.getLogger(this).error("oriented-imagery-viewer:video-load",e)}}_reloadCamera(){this.camera=this.camera?.clone()}_removeImageSphere(){this._imageGraphic&&(this._graphics.remove(this._imageGraphic),this._imageGraphic=m(this._imageGraphic)),this.state="ready",this.imageSize=null}_updateCameraHeadingAndTilt(){if(!this._startPosition||!this._targetPosition||!this.camera)return;const e=this.camera.heading+(this._startPosition.x-this._targetPosition.x)/this.imageRenderer.width*this.camera.fov;this.yaw=(e+360)%360;const t=this.camera.tilt-(this._startPosition.y-this._targetPosition.y)/this.imageRenderer.height*this.imageRenderer.camera.tilt;this.pitch=Math.min(179.5,Math.max(.5,t)),this._startPosition=this._targetPosition}async _updateImageSphere(e,t){return await c(t),this._imageGraphic=L(k(e)),this._graphics.add(this._imageGraphic),this.state="image-loaded",v(()=>this.imageRenderer.ready,t).then(()=>{const{size:[e,t]}=this.imageRenderer;this.fov=x(O,e/t)}),this.imageSize=P,this._imageGraphic.geometry}async _updateVidFootprint(e){const t=this.oiViewModel?.featureCache.find(t=>t.attributes.offsetFromStart===Math.floor(e)),{yaw:i,pitch:o,vfov:a,hfov:r}=this,s=!(t?.attributes.offsetFromStart&&a&&r&&i&&o),n=t?.attributes.objectId===this.closestFeature?.attributes.objectId;s||n||(this.closestFeature=t,await this.oiViewModel.updateFootprintPanorama({yaw:i,pitch:o,verticalFieldOfView:a,horizontalFieldOfView:r,feature:t}))}_updateVideoIcon(e){this.videoPaused=!!e}async loadVideo(e){return this._removeImageSphere(),this.videoSource?this._loadVideoInternal(this.videoSource,e):z(this.declaredClass,new r(H("panoramic-viewer"),b("PanoramicViewerViewModel","videoSource")))}playPanoramicVideoHandler(){const{video:e}=this;e&&(e.paused?e.play().catch(e=>{d.getLogger(this).error("error playing video",e)}):e.pause())}playPanoramicVideoFromSelectedLocation(e){const t=e.attributes.offsetFromStart;if(t){const e=this.video;e&&(e.currentTime=t,e.play().catch(e=>{d.getLogger(this).error("error playing video",e)}))}}rewindPanoramicVideoHandler(){const{video:e}=this;e&&(e.currentTime=0,e.play().catch(e=>{d.getLogger(this).error("error playing video",e)}))}};e([_()],T.prototype,"_graphics",void 0),e([_()],T.prototype,"_imageGraphic",void 0),e([_()],T.prototype,"_imageRenderer",void 0),e([_()],T.prototype,"_loadController",void 0),e([_()],T.prototype,"_map",void 0),e([_()],T.prototype,"_zoomViewModel",void 0),e([_({type:Boolean})],T.prototype,"autoLoad",void 0),e([_({type:t})],T.prototype,"camera",null),e([A(new n({emit:"emit",hittest:"hittest",none:"none","pixel-location":"pixel-location"}))],T.prototype,"clickAction",void 0),e([_()],T.prototype,"closestFeature",void 0),e([_()],T.prototype,"currentTime",void 0),e([_({type:Number})],T.prototype,"fov",null),e([_({readOnly:!0})],T.prototype,"hfov",null),e([_({readOnly:!0})],T.prototype,"imageRenderer",null),e([_()],T.prototype,"imageSize",void 0),e([_()],T.prototype,"oiViewModel",void 0),e([_()],T.prototype,"videoSource",void 0),e([_()],T.prototype,"videoDuration",void 0),e([_()],T.prototype,"videoLoaded",void 0),e([_()],T.prototype,"videoPaused",void 0),e([_()],T.prototype,"videoMuted",void 0),e([_({readOnly:!0})],T.prototype,"maxHFOV",null),e([_({readOnly:!0})],T.prototype,"minHFOV",null),e([_({type:Number})],T.prototype,"pitch",void 0),e([_()],T.prototype,"state",void 0),e([_()],T.prototype,"updatingHandles",void 0),e([_()],T.prototype,"updating",null),e([_({readOnly:!0})],T.prototype,"vfov",null),e([_()],T.prototype,"video",void 0),e([_({type:Number})],T.prototype,"yaw",void 0),T=e([y("esri.widgets.PanoramicViewer.PanoramicVideoViewerViewModel")],T);const E=T;export{E as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../Camera.js";import i from"../../Ground.js";import o from"../../Map.js";import a from"../../core/Collection.js";import r from"../../core/Error.js";import{EventedAccessor as s}from"../../core/Evented.js";import{JSONMap as n}from"../../core/jsonMap.js";import d from"../../core/Logger.js";import{rad2deg as h,deg2rad as l}from"../../core/mathUtils.js";import{destroyMaybe as m}from"../../core/maybe.js";import{waitTick as c}from"../../core/promiseUtils.js";import{watch as p,syncAndInitial as g,when as u,whenOnce as v}from"../../core/reactiveUtils.js";import{property as _,subclass as y}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import w from"../../geometry/SpatialReference.js";import V from"../../layers/GraphicsLayer.js";import{convertSphereVertexToPixelLocation as M}from"../../layers/orientedImagery/transformations/utils.js";import R from"../../views/SceneView.js";import{fixedImageSize as P}from"../OrientedImageryViewer/constants.js";import{logAndThrow as z,getMissingPropertyErrorName as H,getMissingPropertyErrorMessage as b}from"../OrientedImageryViewer/utils.js";import{defaultImageSphereCenter as F,maxPanoramicViewerHFOV as C,minPanoramicViewerHFOV as S,humanBinocularHFOV as O}from"./constants.js";import j from"./PanoramicZoomConditions.js";import I from"./PanoramicZoomViewModel.js";import{findDiagonalFOV as x,meshToGraphic as L,createImageSphere as k}from"./utils.js";import{enumeration as A}from"../../core/accessorSupport/decorators/enumeration.js";const G={default:"default",navigation:"navigation",fovConstraint:"fov-constraint",clickAction:"image-click-action"};let T=class extends s{constructor(e){super(e),this._startPosition=null,this._targetPosition=null,this._graphics=new V({elevationInfo:{mode:"relative-to-ground"}}),this._imageGraphic=null,this._loadController=null,this._map=new o({ground:new i({opacity:0,navigationConstraint:null}),layers:new a([this._graphics])}),this._zoomViewModel=null,this.autoLoad=!1,this.clickAction="none",this.closestFeature=null,this.currentTime=0,this.imageSize=null,this.oiViewModel=null,this.videoSource=null,this.videoDuration=void 0,this.videoLoaded=!1,this.videoPaused=null,this.videoMuted=null,this.pitch=90,this.state="ready",this.updatingHandles=new f,this.video=null,this.yaw=0,this._addNavigationHandles=()=>{this.imageRenderer.basemapTerrain.suspended=!0,this.imageRenderer.constraints.tilt.max=180,this.removeHandles(G.navigation),this.addHandles([this.imageRenderer.on("mouse-wheel",this._handleWheel),this.imageRenderer.on("double-click",this._handleDoubleClick),this.imageRenderer.on("drag",this._handleDrag),this.imageRenderer.on("key-down",e=>{const t=["+","-","Shift","_","=","ArrowUp","ArrowDown","ArrowRight","ArrowLeft"],i=e.key;t.includes(i)&&e.stopPropagation()})],G.navigation)},this._addHFOVHandles=()=>{this.removeHandles(G.fovConstraint),this.addHandles(p(()=>[this.maxHFOV,this.minHFOV],()=>{this._zoomViewModel&&(this._zoomViewModel.panoramicZoomConditions=new j({view:this.imageRenderer,maxFOV:this.maxHFOV,minFOV:this.minHFOV}))},g),G.fovConstraint)},this._addZoomHandles=()=>{this._zoomViewModel=new I({view:this.imageRenderer,panoramicZoomConditions:new j({maxFOV:this.maxHFOV,minFOV:this.minHFOV})});const e=this.imageRenderer.ui.find("zoom");e&&(e.viewModel=this._zoomViewModel),this._addHFOVHandles()},this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._handleDoubleClick=e=>{e.stopPropagation(),e.native.ctrlKey?this._zoomOut():this._zoomIn()},this._handleDrag=e=>{e.stopPropagation();const{action:t,x:i,y:o}=e;switch(t){case"start":this._startPosition=this._targetPosition={x:i,y:o};break;case"update":this._targetPosition={x:i,y:o},this._updateCameraHeadingAndTilt()}},this._handleImageClick=e=>{if("image-loaded"===this.state&&this.imageRenderer.ready)switch(this.clickAction){case"emit":e.stopPropagation(),this.emit("click",e);break;case"hittest":e.stopPropagation(),e.defer(async()=>{const t=await this.imageRenderer.hitTest(e.screenPoint,{include:this._graphics});t.results=t.results.filter(e=>"graphic"===e.type&&e.graphic!==this._imageGraphic),this.emit("hittest-response",t)});break;case"pixel-location":{if(e.stopPropagation(),!this.imageSize||!e.mapPoint)return void this.emit("pixel-location",null);const t=M(e.mapPoint,this.imageSize[0],this.imageSize[1]);this.emit("pixel-location",{...t,spatialReference:w.WebMercator});break}}},this._handleWheel=e=>{const t=e.deltaX??e.native.deltaX;e.stopPropagation(),t>0||e.deltaY>0?this._zoomOut():this._zoomIn()},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadVideo(this._loadController)},this._zoomIn=()=>this._zoomViewModel?.zoomIn(),this._zoomOut=()=>this._zoomViewModel?.zoomOut(),this.addGraphic=(e,t)=>"image-loaded"===this.state&&!this._graphics.graphics.includes(e)&&(this._graphics.graphics.add(e,t),!0),this.addManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const t=e.filter(e=>!this._graphics.graphics.includes(e));return this._graphics.graphics.addMany(t),!0},this.clearGraphics=()=>{this._graphics.graphics.removeAll()},this.clearImage=()=>{this.imageSize=null,this._removeImageSphere()},this.enableAudio=()=>{const{video:e}=this;e&&(e.muted=!1,this.videoMuted=!1)},this.removeGraphic=e=>!("image-loaded"!==this.state||!this._graphics.graphics.includes(e))&&(this._graphics.remove(e),!0),this.removeManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const t=e.filter(e=>this._graphics.graphics.includes(e));return this._graphics.removeMany(t),!0},this.togglePanoramicAudio=()=>{if(this.video){const e=this.video.muted;this.video.muted=!e,this.videoMuted=!e}},this._imageRenderer=new R({map:this._map,viewingMode:"local",camera:{position:F},environment:{atmosphereEnabled:!1,starsEnabled:!1,lighting:{type:"virtual"}},popupEnabled:!1,spatialReference:w.WebMercator,attributionVisible:!1,ui:{components:["zoom"]}})}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([p(()=>this.videoSource,()=>{this.videoSource&&this.autoLoad&&this._loadWithController()},g),p(()=>this.fov,()=>{this._reloadCamera()},g),p(()=>this.yaw,e=>{this.camera&&(this.camera.heading=e,this._reloadCamera())},g),p(()=>this.pitch,e=>{this.camera&&(this.camera.tilt=e,this._reloadCamera())},g),u(()=>this.imageRenderer.ready,()=>{this._addNavigationHandles(),this._addZoomHandles()},g),p(()=>this.clickAction,e=>{this.removeHandles(G.clickAction),"none"!==e&&this.addHandles(this.imageRenderer.on("click",this._handleImageClick))},g),p(()=>this.video,e=>{if(e instanceof HTMLVideoElement){this._startVideo();const t=async()=>{this.currentTime=Number(e.currentTime.toFixed(2)),e.currentTime&&await this._updateVidFootprint(e.currentTime)};e.addEventListener("timeupdate",t),e.addEventListener("play",()=>this._updateVideoIcon(e.paused)),e.addEventListener("pause",()=>this._pauseVideoHandler(e))}},g)],G.default)}get camera(){return this.imageRenderer.destroying||this.imageRenderer.destroyed?null:this.imageRenderer.camera}set camera(e){!e||this.imageRenderer.destroying||this.imageRenderer.destroyed||(this.imageRenderer.camera=e.clone())}get fov(){return this.camera?.fov}set fov(e){Number.isFinite(e)&&this._zoomViewModel?.zoomTo(e)}get hfov(){if(!this.camera||!this.imageRenderer?.ready)return null;const{fov:e}=this.camera,{size:[t,i]}=this.imageRenderer,o=t/i,a=Math.atan(o);return 2*h(Math.atan(Math.tan(l(e/2))*Math.sin(a)))}get imageRenderer(){return this._imageRenderer}get maxHFOV(){const{size:[e,t]}=this.imageRenderer;return this.imageRenderer.ready?x(C,e/t):C}get minHFOV(){const{size:[e,t]}=this.imageRenderer;return this.imageRenderer.ready?x(S,e/t):S}get updating(){return this.updatingHandles.updating}get vfov(){if(!this.camera||!this.imageRenderer?.ready)return null;const{fov:e}=this.camera,{size:[t,i]}=this.imageRenderer,o=t/i,a=Math.atan(o);return 2*h(Math.atan(Math.tan(l(e/2))*Math.cos(a)))}async _loadVideoInternal(e,t){return this.state="image-loading",this.video=document.createElement("video"),this.video.src=e,this.video.addEventListener("loadedmetadata",()=>{this._setVideoDuration(),this.videoLoaded=!0}),this._updateImageSphere(this.video,t)}_pauseVideoHandler(e){this._updateVideoIcon(e.paused)}_setVideoDuration(){const{video:e}=this;e?.duration&&(this.videoDuration=e.duration)}_startVideo(){try{this.enableAudio();const e=this.oiViewModel.currentBestFeature;e&&this.playPanoramicVideoFromSelectedLocation(e)}catch(e){d.getLogger(this).error("oriented-imagery-viewer:video-load",e)}}_reloadCamera(){this.camera=this.camera?.clone()}_removeImageSphere(){this._imageGraphic&&(this._graphics.remove(this._imageGraphic),this._imageGraphic=m(this._imageGraphic)),this.state="ready",this.imageSize=null}_updateCameraHeadingAndTilt(){if(!this._startPosition||!this._targetPosition||!this.camera)return;const e=this.camera.heading+(this._startPosition.x-this._targetPosition.x)/this.imageRenderer.width*this.camera.fov;this.yaw=(e+360)%360;const t=this.camera.tilt-(this._startPosition.y-this._targetPosition.y)/this.imageRenderer.height*this.imageRenderer.camera.tilt;this.pitch=Math.min(179.5,Math.max(.5,t)),this._startPosition=this._targetPosition}async _updateImageSphere(e,t){return await c(t),this._imageGraphic=L(k({data:e})),this._graphics.add(this._imageGraphic),this.state="image-loaded",v(()=>this.imageRenderer.ready,t).then(()=>{const{size:[e,t]}=this.imageRenderer;this.fov=x(O,e/t)}),this.imageSize=P,this._imageGraphic.geometry}async _updateVidFootprint(e){const t=this.oiViewModel?.featureCache.find(t=>t.attributes.offsetFromStart===Math.floor(e)),{yaw:i,pitch:o,vfov:a,hfov:r}=this,s=!(t?.attributes.offsetFromStart&&a&&r&&i&&o),n=t?.attributes.objectId===this.closestFeature?.attributes.objectId;s||n||(this.closestFeature=t,await this.oiViewModel.updateFootprintPanorama({yaw:i,pitch:o,verticalFieldOfView:a,horizontalFieldOfView:r,feature:t}))}_updateVideoIcon(e){this.videoPaused=!!e}async loadVideo(e){return this._removeImageSphere(),this.videoSource?this._loadVideoInternal(this.videoSource,e):z(this.declaredClass,new r(H("panoramic-viewer"),b("PanoramicViewerViewModel","videoSource")))}playPanoramicVideoHandler(){const{video:e}=this;e&&(e.paused?e.play().catch(e=>{d.getLogger(this).error("error playing video",e)}):e.pause())}playPanoramicVideoFromSelectedLocation(e){const t=e.attributes.offsetFromStart;if(t){const e=this.video;e&&(e.currentTime=t,e.play().catch(e=>{d.getLogger(this).error("error playing video",e)}))}}rewindPanoramicVideoHandler(){const{video:e}=this;e&&(e.currentTime=0,e.play().catch(e=>{d.getLogger(this).error("error playing video",e)}))}};e([_()],T.prototype,"_graphics",void 0),e([_()],T.prototype,"_imageGraphic",void 0),e([_()],T.prototype,"_imageRenderer",void 0),e([_()],T.prototype,"_loadController",void 0),e([_()],T.prototype,"_map",void 0),e([_()],T.prototype,"_zoomViewModel",void 0),e([_({type:Boolean})],T.prototype,"autoLoad",void 0),e([_({type:t})],T.prototype,"camera",null),e([A(new n({emit:"emit",hittest:"hittest",none:"none","pixel-location":"pixel-location"}))],T.prototype,"clickAction",void 0),e([_()],T.prototype,"closestFeature",void 0),e([_()],T.prototype,"currentTime",void 0),e([_({type:Number})],T.prototype,"fov",null),e([_({readOnly:!0})],T.prototype,"hfov",null),e([_({readOnly:!0})],T.prototype,"imageRenderer",null),e([_()],T.prototype,"imageSize",void 0),e([_()],T.prototype,"oiViewModel",void 0),e([_()],T.prototype,"videoSource",void 0),e([_()],T.prototype,"videoDuration",void 0),e([_()],T.prototype,"videoLoaded",void 0),e([_()],T.prototype,"videoPaused",void 0),e([_()],T.prototype,"videoMuted",void 0),e([_({readOnly:!0})],T.prototype,"maxHFOV",null),e([_({readOnly:!0})],T.prototype,"minHFOV",null),e([_({type:Number})],T.prototype,"pitch",void 0),e([_()],T.prototype,"state",void 0),e([_()],T.prototype,"updatingHandles",void 0),e([_()],T.prototype,"updating",null),e([_({readOnly:!0})],T.prototype,"vfov",null),e([_()],T.prototype,"video",void 0),e([_({type:Number})],T.prototype,"yaw",void 0),T=e([y("esri.widgets.PanoramicViewer.PanoramicVideoViewerViewModel")],T);const E=T;export{E as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import i from"../../Camera.js";import t from"../../Ground.js";import a from"../../Map.js";import r from"../../request.js";import{createTask as o}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import n from"../../core/Error.js";import{EventedAccessor as h}from"../../core/Evented.js";import{JSONMap as m}from"../../core/jsonMap.js";import{rad2deg as d,deg2rad as l}from"../../core/mathUtils.js";import{throwIfAborted as c,isAbortError as p,waitTick as g}from"../../core/promiseUtils.js";import{watch as u,syncAndInitial as y,when as _,whenOnce as v}from"../../core/reactiveUtils.js";import{property as f,subclass as w}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as M}from"../../core/support/UpdatingHandles.js";import P from"../../geometry/SpatialReference.js";import R from"../../layers/GraphicsLayer.js";import{convertSphereVertexToPixelLocation as V}from"../../layers/orientedImagery/transformations/utils.js";import{isGraphic as z}from"../../support/guards.js";import C from"../../views/SceneView.js";import{logAndThrow as H,getMissingPropertyErrorName as k,getMissingPropertyErrorMessage as G}from"../OrientedImageryViewer/utils.js";import{defaultImageSphereCenter as S,defaultImageSphereSize as b,maxPanoramicViewerHFOV as I,minPanoramicViewerHFOV as O,humanBinocularHFOV as j}from"./constants.js";import x from"./PanoramicZoomConditions.js";import A from"./PanoramicZoomViewModel.js";import{meshToGraphic as F,findDiagonalFOV as T,loadRaster as L,loadPyramid as N,loadMeshes as E,createImageSphere as W}from"./utils.js";import{enumeration as D}from"../../core/accessorSupport/decorators/enumeration.js";const Z={default:"default",navigation:"navigation",fovConstraint:"fov-constraint",clickAction:"image-click-action"};let U=class extends h{constructor(e){super(e),this._panTask=null,this._startPosition=null,this._targetPosition=null,this.tileCache=[],this._graphics=new R({elevationInfo:{mode:"relative-to-ground"}}),this._imageGraphic=null,this.currentGraphics=new s,this.imagePyramid=null,this.imagePyramidLevel=-1,this._map=new a({ground:new t({opacity:0,navigationConstraint:null}),layers:new s([this._graphics])}),this._imageRenderer=new C({map:this._map,viewingMode:"local",camera:{position:S},environment:{atmosphereEnabled:!1,starsEnabled:!1,lighting:{type:"virtual"}},popupEnabled:!1,spatialReference:P.WebMercator,attributionVisible:!1,ui:{components:["zoom"]}}),this._loadController=null,this.zoomViewModel=new A({panoramicViewerViewModel:this,view:this._imageRenderer,panoramicZoomConditions:new x({})}),this.autoLoad=!1,this.clickAction="none",this.imageMeshDistance=b/2,this.imageSize=null,this.imageSource=null,this.navigationManager=null,this.navigationViewModel=null,this.pitch=90,this.state="ready",this.updatingHandles=new M,this.yaw=0,this._addNavigationHandles=(e=!0)=>{this.imageRenderer.basemapTerrain.suspended=!0,this.removeHandles(Z.navigation);const i=[this.imageRenderer.on("mouse-wheel",this._handleWheel),this.imageRenderer.on("drag",this._handleDrag),this.imageRenderer.on("key-down",e=>{const i=["+","-","Shift","_","=","ArrowUp","ArrowDown","ArrowRight","ArrowLeft"],t=e.key;i.includes(t)&&e.stopPropagation()})];e&&i.push(this.imageRenderer.on("double-click",this._handleDoubleClick)),this.addHandles(i,Z.navigation)},this._addHFOVHandles=()=>{this.removeHandles(Z.fovConstraint),this.addHandles(u(()=>[this.maxHFOV,this.minHFOV],()=>{this.zoomViewModel&&(this.zoomViewModel.panoramicZoomConditions=new x({view:this.imageRenderer,maxFOV:this.maxHFOV,minFOV:this.minHFOV}))},y),Z.fovConstraint)},this._addZoomHandles=()=>{this.zoomViewModel=new A({view:this.imageRenderer,panoramicZoomConditions:new x({maxFOV:this.maxHFOV,minFOV:this.minHFOV}),panoramicViewerViewModel:this});const e=this.imageRenderer.ui.find("zoom");e&&(e.viewModel=this.zoomViewModel),this._addHFOVHandles()},this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._createPanTask=()=>{this._panTask?.abort(),this._panTask=o(async e=>{if(!this.imagePyramid)return;const{hfov:i,vfov:t,yaw:a,pitch:r}=this,o=this.imagePyramid.getTiles(this.imagePyramidLevel,a,r,i,t).filter(e=>!this.tileCache.includes(`${e.level}/${e.row}/${e.column}`));if(!o?.length)return;const s=await Promise.all(o.map(async i=>await i.loadMesh({signal:e})));c(e);const n=s.map(F);n.forEach((e,i)=>{const t=o[i].key;e.attributes={key:t},this.tileCache.push(t)}),this.addManyGraphics(n),this.currentGraphics.addMany(n),this._panTask=null})},this._handleDoubleClick=e=>{e.stopPropagation(),e.native.ctrlKey?this._zoomOut():this._zoomIn()},this._handleDrag=e=>{e.stopPropagation();const{action:i,x:t,y:a}=e;switch(i){case"start":this._startPosition=this._targetPosition={x:t,y:a};break;case"update":this._targetPosition={x:t,y:a},this._updateCameraHeadingAndTilt()}},this._handleImageClick=e=>{if("image-loaded"===this.state&&this.imageRenderer.ready)switch(this.clickAction){case"emit":e.stopPropagation(),this.emit("click",e);break;case"hittest":e.stopPropagation(),e.defer(async()=>{const i=await this.imageRenderer.hitTest(e.screenPoint,{include:this._graphics}),t=Array.isArray(this._imageGraphic)?this._imageGraphic:[this._imageGraphic].filter(z);i.results=i.results.filter(e=>"graphic"===e.type&&!t.includes(e.graphic)),this.emit("hittest-response",i)});break;case"pixel-location":{if(e.stopPropagation(),!this.imageSize||!e.mapPoint)return void this.emit("pixel-location",null);const i=V(e.mapPoint,this.imageSize[0],this.imageSize[1]);this.emit("pixel-location",{...i,spatialReference:P.WebMercator});break}}},this._handleWheel=e=>{const i=e.deltaX??e.native.deltaX;e.stopPropagation(),i>0||e.deltaY>0?this._zoomOut():this._zoomIn()},this._loadNavigationManager=async()=>{if(!this.navigationManager||this.navigationManager?.destroyed){const e=await import("../OrientedImageryViewer/navigation/NavigationManagerPanoramic.js").then(e=>e.default);this.navigationManager=new e({viewModel:this.navigationViewModel})}return this.navigationManager},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadImage(this._loadController)},this._zoomIn=()=>{this.zoomViewModel?.zoomIn()},this._zoomOut=()=>{this.zoomViewModel?.zoomOut()},this.addGraphic=(e,i)=>"image-loaded"===this.state&&!this._graphics.graphics.includes(e)&&(this._graphics.graphics.add(e,i),!0),this.addManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const i=e.filter(e=>!this._graphics.graphics.includes(e));return this._graphics.graphics.addMany(i),!0},this.clearGraphics=()=>{this._graphics.graphics.removeAll()},this.clearImage=()=>{this.imageSize=null,this._removeImageSphere()},this.navigate=async(e,i)=>this.updatingHandles.addPromise(this.navigateInternal(e,i)),this.navigateInternal=async(e,i)=>{const t=await this._loadNavigationManager();return await t.navigate(e,i)},this.removeGraphic=e=>!("image-loaded"!==this.state||!this._graphics.graphics.includes(e))&&(this._graphics.remove(e),!0),this.removeManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const i=e.filter(e=>this._graphics.graphics.includes(e));return this._graphics.removeMany(i),!0},this.restoreNavigationHandles=()=>{this._addNavigationHandles(!1)}}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([u(()=>this.imageSource,()=>{this.imageSource&&this.autoLoad&&this._loadWithController()},y),u(()=>this.fov,()=>{this._reloadCamera()},y),u(()=>this.yaw,e=>{this.camera&&(this.camera.heading=e,this._reloadCamera())},y),u(()=>this.pitch,e=>{this.camera&&(this.camera.tilt=e,this._reloadCamera())},y),_(()=>this.imageRenderer.ready,()=>{this._addNavigationHandles(),this._addZoomHandles()},y),u(()=>this.clickAction,e=>{this.removeHandles(Z.clickAction),"none"!==e&&this.addHandles(this.imageRenderer.on("click",this._handleImageClick))},y),u(()=>this.camera,(e,i)=>{this._panTask?.abort(),e?i?.tilt===e.tilt&&i.heading===e.heading||this._createPanTask():this._panTask=null}),this.currentGraphics.on("change",()=>{const e=Array.isArray(this._imageGraphic)?this._imageGraphic:[this._imageGraphic].filter(z),i=this.currentGraphics.map(e=>e.geometry.extent);e.forEach(e=>{e.visible=!0!==i.some(i=>i.intersects(e.geometry.extent))})})],Z.default)}get camera(){return this.imageRenderer.destroying||this.imageRenderer.destroyed?null:this.imageRenderer.camera}set camera(e){!e||this.imageRenderer.destroying||this.imageRenderer.destroyed||(this.imageRenderer.camera=e.clone())}get distanceFactor(){return this.fov?1-5/this.fov:null}get fov(){return this.camera?.fov}set fov(e){Number.isFinite(e)&&this.zoomViewModel?.zoomTo(e)}get hfov(){if(!this.camera||!this.imageRenderer?.ready)return 0;const{fov:e}=this.camera,{size:[i,t]}=this.imageRenderer,a=i/t;return 2*d(Math.atan(Math.tan(l(e/2))*a/Math.sqrt(1+a**2)))}get imageRenderer(){return this._imageRenderer}get maxHFOV(){const{size:[e,i]}=this.imageRenderer;return this.imageRenderer.ready?T(I,e/i):I}get minHFOV(){const{size:[e,i]}=this.imageRenderer;return this.imageRenderer.ready?T(O,e/i):O}get updating(){return this.updatingHandles.updating}get vfov(){if(!this.camera||!this.imageRenderer?.ready)return 0;const{fov:e}=this.camera,{size:[i,t]}=this.imageRenderer,a=i/t;return 2*d(Math.atan(Math.tan(l(e/2))*(1/Math.sqrt(1+a**2))))}_clearImageSphere(){if(!this._imageGraphic)return;const e=Array.isArray(this._imageGraphic)?this._imageGraphic:[this._imageGraphic];this._graphics.removeMany(e),this._imageGraphic=null,e.forEach(e=>e.destroy()),this._graphics.removeMany(this.currentGraphics.toArray()),this.imagePyramid=null,this.imagePyramidLevel=-1,this.tileCache=[]}async _loadImageInternal(e,i){let t;this.state="image-loading";try{t=(await r(e,{responseType:"image",...i})).data}catch(a){throw p(a)?this.state="image-load-aborted":this.state="image-load-error",a}return this._updateImageSphere(t,i)}async loadImageTiled(e,i){this._removeImageSphere(),this.state="image-loading";try{const t=await L(e,i),a=await N(t,i),r=a.getLowResolutionTiles(),o=await E(r,i),{imageSize:s}=a;if(c(i),!r?.length)throw new n("panoramic-viewer:missing-tiles","No tiles were found in the pyramid",{imageSource:e});this.imagePyramid=a,this.imagePyramidLevel=a.maximumPyramidLevel;const h=o.map(F);h.forEach((e,i)=>{const t=r[i].key;e.attributes={key:t},this.tileCache.push(t)}),this._imageGraphic=h,this._graphics.addMany(this._imageGraphic),this.state="image-loaded",v(()=>this.imageRenderer.ready,i).then(()=>{const{size:[e,i]}=this.imageRenderer;this.fov=T(j,e/i)}),this.imageSize=s}catch(t){throw this.state=p(t)?"image-load-aborted":"image-load-error",t}}_reloadCamera(){this.camera=this.camera?.clone()}_removeImageSphere(){this._clearImageSphere(),this.state="ready",this.imageSize=null}_updateCameraHeadingAndTilt(){if(!this._startPosition||!this._targetPosition||!this.camera)return;const e=this.camera.heading+(this._startPosition.x-this._targetPosition.x)/this.imageRenderer.width*this.camera.fov;this.yaw=(e+360)%360;const i=this.camera.tilt-(this._startPosition.y-this._targetPosition.y)/this.imageRenderer.height*this.imageRenderer.camera.tilt;this.pitch=Math.min(179.5,Math.max(.5,i)),this._startPosition=this._targetPosition}async _updateImageSphere(e,i){return await g(i),this._imageGraphic=F(W(e)),this._graphics.add(this._imageGraphic),this.state="image-loaded",v(()=>this.imageRenderer.ready,i).then(()=>{const{size:[e,i]}=this.imageRenderer;this.fov=T(j,e/i)}),this.imageSize=[e.width,e.height],this._imageGraphic.geometry}async loadImage(e){return this._removeImageSphere(),this.imageSource?this._loadImageInternal(this.imageSource,e):H(this.declaredClass,new n(k("panoramic-viewer"),G("PanoramicViewerViewModel","imageSource")))}};e([f()],U.prototype,"_graphics",void 0),e([f()],U.prototype,"_imageGraphic",void 0),e([f({constructOnly:!0})],U.prototype,"currentGraphics",void 0),e([f()],U.prototype,"imagePyramid",void 0),e([f()],U.prototype,"imagePyramidLevel",void 0),e([f()],U.prototype,"_map",void 0),e([f()],U.prototype,"_imageRenderer",void 0),e([f()],U.prototype,"_loadController",void 0),e([f()],U.prototype,"zoomViewModel",void 0),e([f({type:Boolean})],U.prototype,"autoLoad",void 0),e([f({type:i})],U.prototype,"camera",null),e([D(new m({emit:"emit",hittest:"hittest",none:"none","pixel-location":"pixel-location"}))],U.prototype,"clickAction",void 0),e([f()],U.prototype,"distanceFactor",null),e([f({type:Number})],U.prototype,"fov",null),e([f({readOnly:!0})],U.prototype,"hfov",null),e([f()],U.prototype,"imageMeshDistance",void 0),e([f({readOnly:!0})],U.prototype,"imageRenderer",null),e([f()],U.prototype,"imageSize",void 0),e([f()],U.prototype,"imageSource",void 0),e([f({readOnly:!0})],U.prototype,"maxHFOV",null),e([f({readOnly:!0})],U.prototype,"minHFOV",null),e([f()],U.prototype,"navigationViewModel",void 0),e([f({type:Number})],U.prototype,"pitch",void 0),e([f()],U.prototype,"state",void 0),e([f()],U.prototype,"updatingHandles",void 0),e([f()],U.prototype,"updating",null),e([f({readOnly:!0})],U.prototype,"vfov",null),e([f({type:Number})],U.prototype,"yaw",void 0),U=e([w("esri.widgets.PanoramicViewer.PanoramicViewerViewModel")],U);const q=U;export{q as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import i from"../../Camera.js";import t from"../../Ground.js";import a from"../../Map.js";import r from"../../request.js";import{createTask as o}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{deprecatedProperty as n,deprecatedFunction as h}from"../../core/deprecate.js";import m from"../../core/Error.js";import{EventedAccessor as d}from"../../core/Evented.js";import{JSONMap as l}from"../../core/jsonMap.js";import c from"../../core/Logger.js";import{rad2deg as g,deg2rad as p}from"../../core/mathUtils.js";import{throwIfAborted as u,isAbortError as y,waitTick as _}from"../../core/promiseUtils.js";import{watch as v,syncAndInitial as f,whenOnce as w,when as M}from"../../core/reactiveUtils.js";import{property as P,subclass as C}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as R}from"../../core/support/UpdatingHandles.js";import V from"../../geometry/SpatialReference.js";import z from"../../layers/GraphicsLayer.js";import{convertSphereVertexToPixelLocation as G}from"../../layers/orientedImagery/transformations/utils.js";import{isGraphic as S}from"../../support/guards.js";import H from"../../views/SceneView.js";import{logAndThrow as k,getMissingPropertyErrorName as O,getMissingPropertyErrorMessage as j}from"../OrientedImageryViewer/utils.js";import{defaultImageSphereCenter as b,defaultImageSphereSize as I,humanBinocularHFOV as x,maxPanoramicViewerHFOV as A,minPanoramicViewerHFOV as F}from"./constants.js";import L from"./PanoramicZoomConditions.js";import T from"./PanoramicZoomViewModel.js";import{meshToGraphic as N,findDiagonalFOV as E,loadRaster as W,loadPyramid as D,loadMeshes as Z,createImageSphere as U}from"./utils.js";import q from"./support/PanoramicMedia.js";import $ from"./support/PanoramicMediaCollection.js";import{enumeration as K}from"../../core/accessorSupport/decorators/enumeration.js";const X={default:"default",navigation:"navigation",fovConstraint:"fov-constraint",clickAction:"image-click-action"};let B=class extends d{constructor(e){super(e),this._panTask=null,this._startPosition=null,this._targetPosition=null,this.tileCache=new Set,this._graphics=new z({elevationInfo:{mode:"relative-to-ground"}}),this._imageGraphic=null,this.currentGraphics=new s,this.imagePyramid=null,this.imagePyramidLevel=-1,this._map=new a({ground:new t({opacity:0,navigationConstraint:null}),layers:new s([this._graphics])}),this._imageRenderer=new H({map:this._map,viewingMode:"local",camera:{position:b},environment:{atmosphereEnabled:!1,starsEnabled:!1,lighting:{type:"virtual"}},popupEnabled:!1,spatialReference:V.WebMercator,attributionVisible:!1,ui:{components:["zoom"]}}),this._loadController=null,this.zoomViewModel=new T({panoramicViewerViewModel:this,view:this._imageRenderer,panoramicZoomConditions:new L({})}),this.autoLoad=!1,this.clickAction="none",this.mediaCollection=new $,this.imageMeshDistance=I/2,this.imageSize=null,this.navigationManager=null,this.navigationViewModel=null,this.pitch=90,this.state="ready",this.updatingHandles=new R,this.yaw=0,this._addNavigationHandles=(e=!0)=>{this.imageRenderer.basemapTerrain.suspended=!0,this.removeHandles(X.navigation);const i=[this.imageRenderer.on("mouse-wheel",this._handleWheel),this.imageRenderer.on("drag",this._handleDrag),this.imageRenderer.on("key-down",e=>{const i=["+","-","Shift","_","=","ArrowUp","ArrowDown","ArrowRight","ArrowLeft"],t=e.key;i.includes(t)&&e.stopPropagation()})];e&&i.push(this.imageRenderer.on("double-click",this._handleDoubleClick)),this.addHandles(i,X.navigation)},this._addHFOVHandles=()=>{this.removeHandles(X.fovConstraint),this.addHandles(v(()=>[this.maxHFOV,this.minHFOV],()=>{this.zoomViewModel&&(this.zoomViewModel.panoramicZoomConditions=new L({view:this.imageRenderer,maxFOV:this.maxHFOV,minFOV:this.minHFOV}))},f),X.fovConstraint)},this._addZoomHandles=()=>{this.zoomViewModel=new T({view:this.imageRenderer,panoramicZoomConditions:new L({maxFOV:this.maxHFOV,minFOV:this.minHFOV}),panoramicViewerViewModel:this});const e=this.imageRenderer.ui.find("zoom");e&&(e.viewModel=this.zoomViewModel),this._addHFOVHandles()},this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._createPanTask=()=>{this._panTask?.abort(),this._panTask=o(async e=>{if(!this.imagePyramid)return;const{hfov:i,vfov:t,yaw:a,pitch:r}=this,o=this.imagePyramid.getTiles(this.imagePyramidLevel,a,r,i,t).filter(e=>!this.tileCache.has(`${e.level}/${e.row}/${e.column}`));if(!o?.length)return;const s=await Promise.all(o.map(async i=>await i.loadMesh({signal:e})));u(e);const n=s.map(N);n.forEach((e,i)=>{const t=o[i].key;e.attributes={key:t},this.tileCache.add(t)}),this.addManyGraphics(n),this.currentGraphics.addMany(n),this._panTask=null})},this._handleDoubleClick=e=>{e.stopPropagation(),e.native.ctrlKey?this._zoomOut():this._zoomIn()},this._handleDrag=e=>{e.stopPropagation();const{action:i,x:t,y:a}=e;switch(i){case"start":this._startPosition=this._targetPosition={x:t,y:a};break;case"update":this._targetPosition={x:t,y:a},this._updateCameraHeadingAndTilt()}},this._handleImageClick=e=>{if("image-loaded"===this.state&&this.imageRenderer.ready)switch(this.clickAction){case"emit":e.stopPropagation(),this.emit("click",e);break;case"hittest":e.stopPropagation(),e.defer(async()=>{const i=await this.imageRenderer.hitTest(e.screenPoint,{include:this._graphics}),t=Array.isArray(this._imageGraphic)?this._imageGraphic:[this._imageGraphic].filter(S);i.results=i.results.filter(e=>"graphic"===e.type&&!t.includes(e.graphic)),this.emit("hittest-response",i)});break;case"pixel-location":{if(e.stopPropagation(),!this.imageSize||!e.mapPoint)return void this.emit("pixel-location",null);const i=G(e.mapPoint,this.imageSize[0],this.imageSize[1]);this.emit("pixel-location",{...i,spatialReference:V.WebMercator});break}}},this._handleWheel=e=>{const i=e.deltaX??e.native.deltaX;e.stopPropagation(),i>0||e.deltaY>0?this._zoomOut():this._zoomIn()},this._loadNavigationManager=async()=>{if(!this.navigationManager||this.navigationManager?.destroyed){const e=await import("../OrientedImageryViewer/navigation/NavigationManagerPanoramic.js").then(e=>e.default);this.navigationManager=new e({viewModel:this.navigationViewModel})}return this.navigationManager},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadMedia(this.mediaCollection.at(0),this._loadController)},this._zoomIn=()=>{this.zoomViewModel?.zoomIn()},this._zoomOut=()=>{this.zoomViewModel?.zoomOut()},this.addGraphic=(e,i)=>"image-loaded"===this.state&&!this._graphics.graphics.includes(e)&&(this._graphics.graphics.add(e,i),!0),this.addManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const i=e.filter(e=>!this._graphics.graphics.includes(e));return this._graphics.graphics.addMany(i),!0},this.clearGraphics=()=>{this._graphics.graphics.removeAll()},this.clearImage=()=>{this.imageSize=null,this._removeImageSphere()},this.loadMedia=async(e,i)=>{this._removeImageSphere();const{meshOrMeshes:t,size:a,tileKeys:r}=await e.load(i),o=e.imagePyramid;if(u(i),o){const i=t;if(!i?.length)throw new m("panoramic-viewer:missing-tiles","No tiles were found in the pyramid",e.url);const a=i.map(N);a.forEach((e,i)=>{const t=r?.[i];e.attributes={key:t},this.tileCache.add(t)}),this._imageGraphic=a,this._graphics.addMany(this._imageGraphic)}else{const e=t;this._imageGraphic=N(e),this._graphics.add(this._imageGraphic)}this.state="image-loaded",w(()=>this.imageRenderer.ready,i).then(()=>{const{size:[e,i]}=this.imageRenderer;this.fov=E(x,e/i)}),this.imageSize=a},this.navigate=async(e,i)=>this.updatingHandles.addPromise(this.navigateInternal(e,i)),this.navigateInternal=async(e,i)=>{const t=await this._loadNavigationManager();return await t.navigate(e,i)},this.removeGraphic=e=>!("image-loaded"!==this.state||!this._graphics.graphics.includes(e))&&(this._graphics.remove(e),!0),this.removeManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const i=e.filter(e=>this._graphics.graphics.includes(e));return this._graphics.removeMany(i),!0},this.restoreNavigationHandles=()=>{this._addNavigationHandles(!1)}}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([M(()=>this.mediaCollection.length>0,()=>{this.imageSource&&this.autoLoad&&this._loadWithController()},f),v(()=>this.fov,()=>{this._reloadCamera()},f),v(()=>this.yaw,e=>{this.camera&&(this.camera.heading=e,this._reloadCamera())},f),v(()=>this.pitch,e=>{this.camera&&(this.camera.tilt=e,this._reloadCamera())},f),M(()=>this.imageRenderer.ready,()=>{this._addNavigationHandles(),this._addZoomHandles()},f),v(()=>this.clickAction,e=>{this.removeHandles(X.clickAction),"none"!==e&&this.addHandles(this.imageRenderer.on("click",this._handleImageClick))},f),v(()=>this.camera,(e,i)=>{this._panTask?.abort(),e?i?.tilt===e.tilt&&i.heading===e.heading||this._createPanTask():this._panTask=null}),this.currentGraphics.on("change",()=>{const e=Array.isArray(this._imageGraphic)?this._imageGraphic:[this._imageGraphic].filter(S),i=this.currentGraphics.map(e=>e.geometry.extent);e.forEach(e=>{e.visible=!0!==i.some(i=>i.intersects(e.geometry.extent))})})],X.default)}get camera(){return this.imageRenderer.destroying||this.imageRenderer.destroyed?null:this.imageRenderer.camera}set camera(e){!e||this.imageRenderer.destroying||this.imageRenderer.destroyed||(this.imageRenderer.camera=e.clone())}get distanceFactor(){return this.fov?1-5/this.fov:null}get fov(){return this.camera?.fov}set fov(e){Number.isFinite(e)&&this.zoomViewModel?.zoomTo(e)}get hfov(){if(!this.camera||!this.imageRenderer?.ready)return 0;const{fov:e}=this.camera,{size:[i,t]}=this.imageRenderer,a=i/t;return 2*g(Math.atan(Math.tan(p(e/2))*a/Math.sqrt(1+a**2)))}get imageRenderer(){return this._imageRenderer}set imageSource(e){n(c.getLogger(this),"imageSource",{replacement:"Please use mediaCollection instead",warnOnce:!0,version:"5.0"}),e&&this.mediaCollection.splice(0,0,new q({url:e}))}get imageSource(){return n(c.getLogger(this),"imageSource",{replacement:"Please use mediaCollection instead",warnOnce:!0,version:"5.0"}),0===this.mediaCollection.length?null:this.mediaCollection.at(0)?.url}get maxHFOV(){const{size:[e,i]}=this.imageRenderer;return this.imageRenderer.ready?E(A,e/i):A}get minHFOV(){const{size:[e,i]}=this.imageRenderer;return this.imageRenderer.ready?E(F,e/i):F}get updating(){return this.updatingHandles.updating}get vfov(){if(!this.camera||!this.imageRenderer?.ready)return 0;const{fov:e}=this.camera,{size:[i,t]}=this.imageRenderer,a=i/t;return 2*g(Math.atan(Math.tan(p(e/2))*(1/Math.sqrt(1+a**2))))}_clearImageSphere(){if(!this._imageGraphic)return;const e=Array.isArray(this._imageGraphic)?this._imageGraphic:[this._imageGraphic];this._graphics.removeMany(e),this._imageGraphic=null,e.forEach(e=>e.destroy()),this._graphics.removeMany(this.currentGraphics.toArray()),this.imagePyramid=null,this.imagePyramidLevel=-1,this.tileCache.clear()}async _loadImageInternal(e,i){let t;this.state="image-loading";try{t=(await r(e,{responseType:"image",...i})).data}catch(a){throw y(a)?this.state="image-load-aborted":this.state="image-load-error",a}return this._updateImageSphere(t,i)}async loadImageTiled(e,i){this._removeImageSphere(),this.state="image-loading";try{const t=await W(e,i),a=await D(t,i),r=a.getLowResolutionTiles(),o=await Z(r,i),{imageSize:s}=a;if(u(i),!r?.length)throw new m("panoramic-viewer:missing-tiles","No tiles were found in the pyramid",{imageSource:e});this.imagePyramid=a,this.imagePyramidLevel=a.maximumPyramidLevel;const n=o.map(N);n.forEach((e,i)=>{const t=r[i].key;e.attributes={key:t},this.tileCache.add(t)}),this._imageGraphic=n,this._graphics.addMany(this._imageGraphic),this.state="image-loaded",w(()=>this.imageRenderer.ready,i).then(()=>{const{size:[e,i]}=this.imageRenderer;this.fov=E(x,e/i)}),this.imageSize=s}catch(t){throw this.state=y(t)?"image-load-aborted":"image-load-error",t}}_reloadCamera(){this.camera=this.camera?.clone()}_removeImageSphere(){this._clearImageSphere(),this.state="ready",this.imageSize=null}_updateCameraHeadingAndTilt(){if(!this._startPosition||!this._targetPosition||!this.camera)return;const e=this.camera.heading+(this._startPosition.x-this._targetPosition.x)/this.imageRenderer.width*this.camera.fov;this.yaw=(e+360)%360;const i=this.camera.tilt-(this._startPosition.y-this._targetPosition.y)/this.imageRenderer.height*this.imageRenderer.camera.tilt;this.pitch=Math.min(179.5,Math.max(.5,i)),this._startPosition=this._targetPosition}async _updateImageSphere(e,i){return await _(i),this._imageGraphic=N(U({data:e})),this._graphics.add(this._imageGraphic),this.state="image-loaded",w(()=>this.imageRenderer.ready,i).then(()=>{const{size:[e,i]}=this.imageRenderer;this.fov=E(x,e/i)}),this.imageSize=[e.width,e.height],this._imageGraphic.geometry}async loadImage(e){return h(c.getLogger(this),"loadImage",{replacement:"loadImage is deprecated in favor of loadMedia",warnOnce:!0,version:"5.0"}),this._removeImageSphere(),this.imageSource?this._loadImageInternal(this.imageSource,e):k(this.declaredClass,new m(O("panoramic-viewer"),j("PanoramicViewerViewModel","imageSource")))}};e([P()],B.prototype,"_graphics",void 0),e([P()],B.prototype,"_imageGraphic",void 0),e([P({constructOnly:!0})],B.prototype,"currentGraphics",void 0),e([P()],B.prototype,"imagePyramid",void 0),e([P()],B.prototype,"imagePyramidLevel",void 0),e([P()],B.prototype,"_map",void 0),e([P()],B.prototype,"_imageRenderer",void 0),e([P()],B.prototype,"_loadController",void 0),e([P()],B.prototype,"zoomViewModel",void 0),e([P({type:Boolean})],B.prototype,"autoLoad",void 0),e([P({type:i})],B.prototype,"camera",null),e([K(new l({emit:"emit",hittest:"hittest",none:"none","pixel-location":"pixel-location"}))],B.prototype,"clickAction",void 0),e([P()],B.prototype,"distanceFactor",null),e([P({type:Number})],B.prototype,"fov",null),e([P({readOnly:!0})],B.prototype,"hfov",null),e([P({type:$})],B.prototype,"mediaCollection",void 0),e([P()],B.prototype,"imageMeshDistance",void 0),e([P({readOnly:!0})],B.prototype,"imageRenderer",null),e([P()],B.prototype,"imageSize",void 0),e([P()],B.prototype,"imageSource",null),e([P({readOnly:!0})],B.prototype,"maxHFOV",null),e([P({readOnly:!0})],B.prototype,"minHFOV",null),e([P()],B.prototype,"navigationViewModel",void 0),e([P({type:Number})],B.prototype,"pitch",void 0),e([P()],B.prototype,"state",void 0),e([P()],B.prototype,"updatingHandles",void 0),e([P()],B.prototype,"updating",null),e([P({readOnly:!0})],B.prototype,"vfov",null),e([P({type:Number})],B.prototype,"yaw",void 0),B=e([C("esri.widgets.PanoramicViewer.PanoramicViewerViewModel")],B);const Y=B;export{Y as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as o}from"tslib";import i from"../../core/Accessor.js";import{createTask as e}from"../../core/asyncUtils.js";import{throwIfAborted as t}from"../../core/promiseUtils.js";import{property as s,subclass as a}from"../../core/accessorSupport/decorators.js";import{meshToGraphic as r}from"./utils.js";let m=class extends i{constructor(o){super(o),this._zoomTask=null,this.panoramicZoomViewModel=null,this._updateGraphicsFromTiles=async(o,i,e,s,a)=>{const m=await Promise.all(o.map(async o=>{const i=await o.loadMesh(a);return r(i)}));t(a);const n=s.removeAll();i.
|
|
5
|
+
import{__decorate as o}from"tslib";import i from"../../core/Accessor.js";import{createTask as e}from"../../core/asyncUtils.js";import{throwIfAborted as t}from"../../core/promiseUtils.js";import{property as s,subclass as a}from"../../core/accessorSupport/decorators.js";import{meshToGraphic as r}from"./utils.js";let m=class extends i{constructor(o){super(o),this._zoomTask=null,this.panoramicZoomViewModel=null,this._updateGraphicsFromTiles=async(o,i,e,s,a)=>{const m=await Promise.all(o.map(async o=>{const i=await o.loadMesh(a);return r(i)}));t(a);const n=s.removeAll();i.clear(),m.forEach((e,t)=>{const s=o[t].key;e.attributes={key:s},i.add(s)}),s.addMany(m),this.viewModel?.set({imagePyramidLevel:e}),this.viewModel?.addManyGraphics(m),this.viewModel?.removeManyGraphics(n)},this._zoomIn=async o=>{if(t(o),!this.viewModel)return this.panoramicZoomViewModel.zoomInFOV();const{imagePyramid:i,yaw:e,hfov:s,vfov:a,pitch:r,tileCache:m,currentGraphics:n,imageRenderer:{size:l},imagePyramidLevel:c}=this.viewModel;if(!i)return this.panoramicZoomViewModel.zoomInFOV();const h=s/l[0],d=i.getLevelWithPixelAngle(h);if(0===c||c===d)return this.panoramicZoomViewModel.zoomInFOV();const p=i.getTiles(d,e,r,s,a);return p?(await this._updateGraphicsFromTiles(p,m,d,n,{signal:o}),this.panoramicZoomViewModel.zoomInFOV()):this.panoramicZoomViewModel.zoomInFOV()},this._zoomOut=async o=>{if(t(o),!this.viewModel)return this.panoramicZoomViewModel.zoomOutFOV();const{imagePyramid:i,yaw:e,hfov:s,vfov:a,pitch:r,tileCache:m,currentGraphics:n,imagePyramidLevel:l,imageRenderer:{size:c}}=this.viewModel;if(!i)return this.panoramicZoomViewModel.zoomOutFOV();const h=i.maximumPyramidLevel,d=s/c[0],p=i.getLevelWithPixelAngle(d);if(h===l||p===l)return this.panoramicZoomViewModel.zoomOutFOV();const u=i.getTiles(p,e,r,s,a);return u?(await this._updateGraphicsFromTiles(u,m,p,n,{signal:o}),this.panoramicZoomViewModel.zoomOutFOV()):this.panoramicZoomViewModel.zoomOutFOV()},this.zoomIn=o=>{(null==this._zoomTask||this._zoomTask.finished)&&(this._zoomTask=e(this._zoomIn,o))},this.zoomOut=o=>{(null==this._zoomTask||this._zoomTask.finished)&&(this._zoomTask=e(this._zoomOut,o))}}};o([s()],m.prototype,"viewModel",void 0),o([s()],m.prototype,"panoramicZoomViewModel",void 0),m=o([a("esri.widgets.PanoramicViewer.PanoramicZoomManager")],m);export{m as PanoramicZoomManager};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{__decorate as i}from"tslib";import{on as o}from"../../../core/events.js";import{rad2deg as t}from"../../../core/mathUtils.js";import{EsriPromise as e}from"../../../core/Promise.js";import{createResolver as s,onAbort as r}from"../../../core/promiseUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{whenVideoPlayable as n}from"../../../layers/support/videoUtils.js";import{fixedImageSize as l}from"../../OrientedImageryViewer/constants.js";import{guessExtensionFromURI as m,loadRaster as d,loadPyramid as c,loadMeshes as p,createImageSphere as u}from"../utils.js";import z from"./PanoramicMediaError.js";const y=0,w=0,g=0,f=new Set(["JPG","JPEG","TIFF","TIF","MRF"]),P=new Set(["MRF","TIFF","TIF"]);let v=class extends e{constructor(i){super(i),this._size=[0,0],this._cache=null,this.autoLoad=!1,this.cameraHeading=null,this.extension=null,this.imagePyramid=null,this.type="image",this.uiStrings={}}destroy(){this._cache=null}get horizonPitch(){const{matrix:i}=this;return i?t(Math.asin(-i[6])):y}get horizonRoll(){const{matrix:i}=this;return i?t(Math.atan(i[7]/i[8])):g}get horizonYaw(){const{matrix:i,cameraHeading:o}=this;return i?t(Math.atan2(i[3],i[0])):o?-o:w}get size(){return this._size}async load(i){if("video"===this.type)return this.loadVideoMesh(i);let o=this.extension;if(o||(o=m(this.url)),!o||!f.has(o))throw new z("unsupported-format",this.uiStrings["unsupported-format"]??"Unsupported image format: {extension}",{extension:o});return P.has(o)?this.loadOptimizedImageMesh(i):this.loadImageMesh(i)}async loadOptimizedImageMesh(i){const o=await d(this.url,i);this.imagePyramid=await c(o,i);const t=this.imagePyramid.getLowResolutionTiles(),e=await p(t,i);return this._size=this.imagePyramid.imageSize,{meshOrMeshes:e,size:this._size,tileKeys:t?.map(i=>i.key)}}async loadVideoMesh(i){if(this._cache){return{meshOrMeshes:await u({data:this._cache,horizonPitch:this.horizonPitch,horizonRoll:this.horizonRoll,horizonYaw:this.horizonYaw}).load(i),size:this._size}}const o=await this._resolveMedia(i);this._cache=o.media,this._size=[...l];return{meshOrMeshes:await u({data:this._cache,horizonPitch:this.horizonPitch,horizonRoll:this.horizonRoll,horizonYaw:this.horizonYaw}).load(i),size:this._size}}async loadImageMesh(i){if(this._cache){return{meshOrMeshes:await u({data:this._cache,horizonPitch:this.horizonPitch,horizonRoll:this.horizonRoll,horizonYaw:this.horizonYaw}).load(i),size:this._size}}const o=await this._resolveMedia(i);this._cache=o.media;const t=o.mesh;return this._size=[o.media.width,o.media.height],{meshOrMeshes:t,size:this._size}}async _resolveMedia(i){const t=s(),e=r(i?.signal,t.resolve),a="video"===this.type?document.createElement("video"):document.createElement("img");a.crossOrigin="anonymous",a.src=this.url;let h=null;const l="video"===this.type?n(a,this.addHandles):await new Promise((i,t)=>{h=[o(a,"error",()=>{t(new z("unknown",this.uiStrings["media-load-failure"]??"Could not load media from URL: {url}",{url:this.url}))}),o(a,"load",i)]}).finally(()=>{h?.forEach(i=>i.remove()),h=null}),m=Promise.race([l,t.promise]);this.addResolvingPromise(m);try{await m}finally{e?.remove()}const d=a;if(!d)throw new z("unknown","Could not load media",{url:this.url});return{media:d,mesh:await u({data:a,horizonPitch:this.horizonPitch,horizonRoll:this.horizonRoll,horizonYaw:this.horizonYaw}).load(i)}}};i([a()],v.prototype,"_size",void 0),i([a()],v.prototype,"autoLoad",void 0),i([a()],v.prototype,"cameraHeading",void 0),i([a()],v.prototype,"extension",void 0),i([a()],v.prototype,"horizonPitch",null),i([a()],v.prototype,"horizonRoll",null),i([a()],v.prototype,"horizonYaw",null),i([a()],v.prototype,"id",void 0),i([a()],v.prototype,"imagePyramid",void 0),i([a()],v.prototype,"matrix",void 0),i([a()],v.prototype,"size",null),i([a()],v.prototype,"type",void 0),i([a()],v.prototype,"uiStrings",void 0),i([a()],v.prototype,"url",void 0),i([a()],v.prototype,"load",null),v=i([h("esri.widgets.PanoramicViewer.support.PanoramicMedia")],v);const _=v;export{_ as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import o from"../../../core/Collection.js";import r from"./PanoramicMedia.js";const e=o.ofType(r);export{e as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import r from"../../../core/Error.js";class s extends r{constructor(r,s,e){super(r,s,e),this.name="unknown",this.name=r}}export{s as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../Graphic.js";import r from"../../core/Collection.js";import
|
|
5
|
+
import t from"../../Graphic.js";import r from"../../request.js";import e from"../../core/Collection.js";import o from"../../core/Error.js";import{rad2deg as n,deg2rad as s}from"../../core/mathUtils.js";import{throwIfAborted as i}from"../../core/promiseUtils.js";import a from"../../geometry/Mesh.js";import m from"../../geometry/support/MeshMaterial.js";import c from"../../geometry/support/MeshTexture.js";import u from"../../symbols/FillSymbol3DLayer.js";import l from"../../symbols/MeshSymbol3D.js";import{defaultImageSphereCenter as p,defaultImageSphereSize as f}from"./constants.js";import{loadRasterFactory as h,loadPanoramicTilePyramid as w}from"./support/importUtils.js";function y({data:t,center:r=p,size:e=f,horizonPitch:o=0,horizonYaw:n=0,horizonRoll:s=0}){const i=r.clone();i.z=-e/2;const u=a.createSphere(i,{size:e,densificationFactor:2,vertexSpace:"georeferenced",material:new m({colorTexture:new c({data:t})})});if(u.components[0].trustSourceNormals=!0,u.vertexAttributes.uv){const t=u.vertexAttributes.uv.length??0;for(let r=0;r<t;r++)u.vertexAttributes.uv[2*r+0]=1-u.vertexAttributes.uv[2*r+0]}return u.rotate(o,s,n,{origin:u.extent.center}),u.centerAt(i),u}function j(r){return new t({geometry:r,symbol:new l({symbolLayers:new e([new u])})})}function g(t,r){return 2*n(Math.atan(Math.tan(s(t/2))*Math.sqrt((1/r)**2+1)))}async function d(t,r){const e=await h(),o=await e.open({url:t,ioConfig:{skipExtensions:["jgw","aux.xml"],skipMapInfo:!0},...r});return i(r),x(o,{url:t})}const x=(t,r)=>{if(!t)throw new o("panoramic-viewer:missing-raster","Raster data could not be loaded",r);return t};async function b(t,r){const e=await w();return i(r),new e({raster:t})}async function v(t,r){return t?.length?await Promise.all(t.map(t=>t.loadMesh(r))):[]}async function M(t,e){try{const o=await r(t,{...e,method:"head"});return i(e),o?.getHeader?.("Content-Type")}catch{return null}}const z=/\.(\w+)$/;function A(t){const r=t.match(z);return!r||r.length<2?null:r[1].toUpperCase()}export{y as createImageSphere,g as findDiagonalFOV,M as getContentType,A as guessExtensionFromURI,v as loadMeshes,b as loadPyramid,d as loadRaster,j as meshToGraphic};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../Camera.js";import{property as i,subclass as o}from"../core/accessorSupport/decorators.js";import r from"./Widget.js";import a from"./OrientedImageryViewer/components/NavigationUI360.js";import{loadSequentialNavigationUIComponents as n,SequentialNavigationUI as
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../Camera.js";import{property as i,subclass as o}from"../core/accessorSupport/decorators.js";import r from"./Widget.js";import a from"./OrientedImageryViewer/components/NavigationUI360.js";import{loadSequentialNavigationUIComponents as n,SequentialNavigationUI as l}from"./OrientedImageryViewer/components/SequentialNavigationUI.js";import s from"./PanoramicViewer/PanoramicViewerViewModel.js";import{loadCalciteComponents as d}from"./support/componentsUtils.js";import{globalCss as c}from"./support/globalCss.js";import{tsx as p,vmEvent as u}from"./support/widget.js";const v="esri-panoramic-viewer";let h=class extends r{constructor(e){super(e),this.directionMode="Relative",this.navigationEnabled=!1,this.uiStrings=null,this.viewModel=new s,this._afterContainerCreate=e=>{this.imageRenderer.container=e},this.addGraphic=(e,t)=>{this.viewModel.addGraphic(e,t)},this.addManyGraphics=e=>{this.viewModel.addManyGraphics(e)},this.clearGraphics=()=>{this.viewModel.clearGraphics()},this.clearImage=()=>{this.viewModel.clearImage()},this.loadImage=e=>this.viewModel.loadImage(e),this.loadImageTiled=(e,t)=>this.viewModel.loadImageTiled(e,t),this.navigate=async(e,t)=>await this.viewModel.navigate(e,t),this.removeGraphic=e=>{this.viewModel.removeGraphic(e)},this.removeManyGraphics=e=>{this.viewModel.removeManyGraphics(e)}}loadDependencies(){return Promise.all([d({panel:()=>import("@esri/calcite-components/dist/components/calcite-panel")}),n()])}get autoLoad(){return this.viewModel.autoLoad}set autoLoad(e){this.viewModel.autoLoad=e}get camera(){return this.viewModel.camera}set camera(e){e&&(this.viewModel.camera=e)}get clickAction(){return this.viewModel.clickAction}set clickAction(e){this.viewModel.clickAction=e}get currentNode(){return this.navigationViewModel?.currentNode}get currentBestFeature(){return this.navigationViewModel?.currentBestFeature}get fov(){return this.camera?.fov}set fov(e){this.viewModel.fov=e}get hfov(){return this.viewModel.hfov}get icon(){return"i360-view"}set icon(e){this._overrideIfSome("icon",e)}get imageRenderer(){return this.viewModel.imageRenderer}get imageSize(){return this.viewModel.imageSize}get mediaCollection(){return this.viewModel.mediaCollection}set mediaCollection(e){this.viewModel.mediaCollection=e}get imageSource(){return this.viewModel.imageSource}set imageSource(e){this.viewModel.imageSource=e}get navigationMode(){return this.navigationViewModel?.navigationMode}get navigationNodes(){return this.navigationViewModel?.navigationNodes}get navigationViewModel(){return this.viewModel.navigationViewModel}set navigationViewModel(e){this.viewModel.navigationViewModel=e}get pitch(){return this.viewModel.pitch}set pitch(e){this.viewModel.pitch=e}get state(){return this.viewModel.state}get ui(){return this.imageRenderer.ui}get vfov(){return this.viewModel.vfov}get yaw(){return this.viewModel.yaw}set yaw(e){this.viewModel.yaw=e}get _navigationUI(){return p(a,{currentBestFeature:this.currentBestFeature,currentNode:this.currentNode,directionMode:this.directionMode,navigate:this.navigate,nodes:this.navigationNodes})}get _sequentialNavigationUI(){return p(l,{layout:"horizontal",uiStrings:this.uiStrings,onAction:e=>{this.navigate(this.currentNode,e)}})}_renderNavigationUI(){switch(this.navigationMode){case"directional":return this._navigationUI;case"sequential":return this._sequentialNavigationUI;default:return null}}render(){return p("calcite-panel",{loading:this.viewModel.updating},p("calcite-panel",{afterCreate:this._afterContainerCreate,bind:this,class:this.classes(c.widget,v)}),this.navigationEnabled?this._renderNavigationUI():null)}static{this.vnodeSelector="calcite-panel"}};e([i({type:Boolean})],h.prototype,"autoLoad",null),e([i({type:t})],h.prototype,"camera",null),e([i()],h.prototype,"clickAction",null),e([i()],h.prototype,"currentNode",null),e([i()],h.prototype,"currentBestFeature",null),e([i()],h.prototype,"directionMode",void 0),e([i({type:Number})],h.prototype,"fov",null),e([i({readOnly:!0,type:Number})],h.prototype,"hfov",null),e([i()],h.prototype,"icon",null),e([i({readOnly:!0})],h.prototype,"imageRenderer",null),e([i({readOnly:!0})],h.prototype,"imageSize",null),e([i()],h.prototype,"mediaCollection",null),e([i()],h.prototype,"imageSource",null),e([i({type:Boolean})],h.prototype,"navigationEnabled",void 0),e([i()],h.prototype,"navigationMode",null),e([i()],h.prototype,"navigationNodes",null),e([i()],h.prototype,"navigationViewModel",null),e([i({type:Number})],h.prototype,"pitch",null),e([i({readOnly:!0})],h.prototype,"state",null),e([i()],h.prototype,"ui",null),e([i()],h.prototype,"uiStrings",void 0),e([i({readOnly:!0,type:Number})],h.prototype,"vfov",null),e([u(["click","hittest-response","pixel-location"]),i({type:s})],h.prototype,"viewModel",void 0),e([i({type:Number})],h.prototype,"yaw",null),e([i()],h.prototype,"_navigationUI",null),e([i()],h.prototype,"_sequentialNavigationUI",null),h=e([o("esri.widgets.PanoramicViewer")],h);const g=h;export{g as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{id as o}from"../../kernel.js";import e from"../../core/Error.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{createMD5Hash as s}from"../../core/MD5.js";import{isAbortError as a}from"../../core/promiseUtils.js";import{property as
|
|
5
|
+
import{__decorate as t}from"tslib";import{id as o}from"../../kernel.js";import e from"../../core/Error.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{createMD5Hash as s}from"../../core/MD5.js";import{isAbortError as a}from"../../core/promiseUtils.js";import{property as n,subclass as i}from"../../core/accessorSupport/decorators.js";import l from"../../portal/PortalItem.js";import{formatJsonMap as p}from"../../rest/support/fileFormat.js";import{fromJSON as u}from"../../rest/support/layoutTemplate.js";import{valueUnitKebabDict as d,fetchLayoutTemplateInfos as m}from"./utils.js";import{enumeration as y}from"../../core/accessorSupport/decorators/enumeration.js";let h=class extends r{constructor(t){super(t),this.description=null,this.format=null,this.state="not-loaded",this.label=null,this.layoutInfoTaskUrl=null,this.layout=null,this.layoutItem=null,this.layoutOptions=null,this.layoutTemplateInfo=null,this.type=null}get id(){return this.layoutItem?.id??`${this.layout}-${s(JSON.stringify(this.toJSON()))}`}get mapSurroundInfoOptions(){const t=this.layoutTemplateInfo?.layoutOptions?.mapSurroundInfos;if(!t)return null;const o={northArrow:[],scaleBar:[],legend:[]};for(const e of t)switch(e.type){case"CIMMarkerNorthArrow":o.northArrow.push(e);break;case"CIMScaleLine":o.scaleBar.push(e);break;case"CIMGroupElement":e.elements?.some(t=>"CIMScaleLine"===t.type)&&o.scaleBar.push(e);break;case"CIMLegend":o.legend.push(e)}return o}get pageUnits(){return d.fromJSON(this.layoutTemplateInfo?.pageUnits?.toLowerCase())}_updateLayoutOptions(t){const o=this.layoutOptions?.legend??t.layoutOptions?.hasLegend,e=this.layoutOptions?.dynamicLegend??(this.mapSurroundInfoOptions?.legend.length?this.mapSurroundInfoOptions?.legend.some(({defaultLegendItem:t})=>t?.dynamicLegends):void 0),r=this.layoutOptions?.northArrow??(this.mapSurroundInfoOptions?.northArrow.length?this.mapSurroundInfoOptions?.northArrow.some(({visible:t})=>t):void 0),s=this.layoutOptions?.scaleBar??(this.mapSurroundInfoOptions?.scaleBar.length?this.mapSurroundInfoOptions?.scaleBar.some(({visible:t})=>t):void 0);this._set("layoutOptions",{legend:o,northArrow:r,scaleBar:s,dynamicLegend:e})}async fetchLayoutItemTemplateInfo(t){const{layoutItem:r}=this;if(r?.id&&!this.layoutTemplateInfo&&"loaded"!==this.state)try{this._set("state","loading");const s=this.layoutInfoTaskUrl;if(!s)throw new e("print:invalid-layout-info-task-url","Can't fetch layout template info",{url:s});"public"!==r.access&&o&&await o.getCredential(s);const a={Layout_Item_ID:JSON.stringify({id:r.id})},n=(await m(s,a,t))[0];this.setLayoutTemplateInfo(n)}catch(s){this._set("state",a(s)?"not-loaded":"error")}}setLayoutTemplateInfo(t){this._set("layoutTemplateInfo",t),this._updateLayoutOptions(t),this._set("state","loaded")}};t([n({json:{write:!0}})],h.prototype,"description",void 0),t([y(p)],h.prototype,"format",void 0),t([n({readOnly:!0})],h.prototype,"id",null),t([n({readOnly:!0})],h.prototype,"state",void 0),t([n({json:{write:!0}})],h.prototype,"label",void 0),t([n()],h.prototype,"layoutInfoTaskUrl",void 0),t([n({json:{read:u,write:!0}})],h.prototype,"layout",void 0),t([n({type:l,json:{write:!0}})],h.prototype,"layoutItem",void 0),t([n({readOnly:!0,json:{write:!0}})],h.prototype,"layoutOptions",void 0),t([n({readOnly:!0})],h.prototype,"layoutTemplateInfo",void 0),t([n({readOnly:!0})],h.prototype,"mapSurroundInfoOptions",null),t([n({readOnly:!0})],h.prototype,"pageUnits",null),t([n()],h.prototype,"type",void 0),h=t([i("esri.widgets.Print.CustomTemplate")],h);const c=h;export{c as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{isSome as e}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import i from"../../core/Error.js";import{EventedAccessor as o}from"../../core/Evented.js";import{clone as a}from"../../core/lang.js";import{LoadableMixin as r}from"../../core/Loadable.js";import{EsriPromiseMixin as l}from"../../core/Promise.js";import n from"../../core/ReactiveMap.js";import{watch as p,initial as m}from"../../core/reactiveUtils.js";import{createScreenPoint as h}from"../../core/screenUtils.js";import{unitType as d,convertUnit as u,getMetersPerUnitForSR as c,inchesPerMeter as f}from"../../core/units.js";import{property as y,subclass as T}from"../../core/accessorSupport/decorators.js";import v from"../../geometry/Extent.js";import w from"../../geometry/SpatialReference.js";import{formatDate as _,convertDateFormatToIntlOptions as I}from"../../intl/date.js";import{getLocaleLanguage as g}from"../../intl/locale.js";import x from"../../portal/Portal.js";import O from"../../portal/PortalQueryParams.js";import{reArcGISOnlineDomain as b}from"../../portal/support/urlUtils.js";import{execute as E,getTaskInfo as P}from"../../rest/print.js";import{formatJsonMap as L}from"../../rest/support/fileFormat.js";import{fromJSON as S}from"../../rest/support/layoutTemplate.js";import U from"../../rest/support/PrintParameters.js";import k from"../../rest/support/PrintTemplate.js";import{getExtent as C}from"../../views/2d/viewpointUtils.js";import{ViewEventPriorities as j}from"../../views/input/InputManager.js";import F from"../../views/overlay/BoxOverlayItem.js";import H from"./CustomTemplate.js";import M from"./FileLink.js";import D from"./TemplateOptions.js";import{fetchLayoutTemplateInfos as A,valueUnitKebabDict as W}from"./utils.js";const R=[30,144,255,255],N=[237,211,23,255],z=[216,48,32,255],V=new Set(["GISProfessionalStdUT","GISProfessionalAdvUT"]),B=/(\/GPServer\/).+/i,G=96,q=s.ofType(H),$=s.ofType(M);function J(t){t.layoutOptions??={},t.layoutOptions.customTextElements??=[];const e="date";if(!t.layoutOptions.customTextElements.find(t=>e in t)){const{customTextElements:e}=t.layoutOptions;let s=_(Date.now(),I("short-date"));"ar"===g()&&(s=""+s),e.push({date:s})}}function Q(t,e,s){if(!e)return;!(e.visible===s)&&t.layoutOptions&&(t.layoutOptions.elementOverrides?t.layoutOptions.elementOverrides[e.name]={visible:s}:t.layoutOptions.elementOverrides={[e.name]:{visible:s}})}let K=class extends(r(l(o))){constructor(t){super(t),this._serviceTemplateCustomTextElements=null,this._templateIdToCustomTemplate=new n,this._isFreeHand=!1,this._freeHandWidth=0,this._freehandHeight=0,this._asyncPrintTaskUrl=null,this._layoutInfoTaskUrl=null,this._portalLayoutInfoTaskUrl=null,this._customLayoutOptions=null,this._exportedFileNameMap={},this._layoutTemplateInfosCache=new Map,this._tasksInfoCache=new Map,this.allowedFormats="all",this.allowedLayouts="all",this.browseTemplates=new q,this.defaultTemplates=new q,this.error=null,this.exportedLinks=new $,this.extraParameters=null,this.includeDefaultTemplates=!0,this.outSpatialReference=null,this.portal=x.getDefault(),this.portalTemplateIds=[],this.printServiceTemplates=new q,this.defaultTemplate=null,this.showPrintAreaEnabled=!1,this.printServiceUrl=null,this.printTimeout=12e4,this.saveExportEnabled=!1,this.templatesInfo=null,this.updateDelay=1e3,this.view=null,this.templateCustomTextElements=null,this.templateOptions=new D}initialize(){this.addHandles([p(()=>[this.showPrintAreaEnabled,this.view],()=>{this.showPrintAreaEnabled?this._enablePrintPreview():(this.removeHandles("overlay-handler"),this.view?.overlay?.removeItem(this._getOverlayItem()))}),p(()=>[this.templateOptions.layout,this.templateOptions.layoutItem],()=>{this.loaded&&this._processTemplateOptions()}),p(()=>[this.allowedFormats,this.allowedLayouts],()=>{this.loaded&&this._loadTemplateInfos()}),p(()=>this.exportedLinks,()=>{for(const{name:t,extension:e}of this.exportedLinks)t&&e&&this._updateExportedFileNameMap(`${t}${e}`)},m)])}destroy(){this.removeHandles("overlay-handler"),this.view&&(this._overlayItem&&(this.view.overlay?.removeItem(this._overlayItem),this._overlayItem.destroy(),this._overlayItem=null),this.view=null)}get effectivePrintServiceUrl(){return this.printServiceUrl??null}get effectiveTemplateCustomTextElements(){if(!this._serviceTemplateCustomTextElements)return{};const t=a(this._serviceTemplateCustomTextElements);return this.templateCustomTextElements&&Object.keys(this.templateCustomTextElements).forEach(e=>{const s=t[e];if(s){const t=this.templateCustomTextElements?.[e];s.forEach(e=>{const[s]=Object.entries(e)[0];t?.forEach(t=>{const[i,o]=Object.entries(t)[0];s===i&&(e[s]=o)})})}}),Object.freeze(t)}get state(){return"loading"===this.loadStatus?"initializing":"failed"===this.loadStatus||this.error?"error":"loaded"===this.loadStatus&&this.view?.ready?"ready":"disabled"}async print(t){const{view:e,extraParameters:s,updateDelay:o,outSpatialReference:a}=this;if(!e)throw new i("print:view-required","view is not set");J(t);const r=this._getOverlayItem(),l=t.scalePreserved||!this.showPrintAreaEnabled?void 0:C(new v,e.viewpoint,"map-only"===t.layout?[t.exportOptions.width,t.exportOptions.height]:[r.boxWidth,r.boxHeight]),n=new U({view:e,template:t,extent:l,extraParameters:s,updateDelay:o,outSpatialReference:a});try{const e=!!t.layoutItem?.id&&(this.portalTemplateIds.includes(t.layoutItem.id)||this.browseTemplates.some(e=>e.layoutItem?.id===t.layoutItem?.id));return await E(e&&this._asyncPrintTaskUrl?this._asyncPrintTaskUrl:this.effectivePrintServiceUrl,n,{timeout:this.printTimeout})}catch(p){throw new i("print:export-error","An error occurred while exporting the web map.",{error:p})}}async load(t){return this.addResolvingPromise(this._loadResources(t).catch(t=>this.error=t)),this}toPrintTemplate({attributionEnabled:t,author:e,copyright:s,customTextElements:o,dpi:a,forceFeatureAttributes:r,format:l,height:n,id:p,includeTables:m,layout:h,layoutItem:d,legendEnabled:u,northArrowEnabled:c,scale:f,scaleBarEnabled:y,scaleEnabled:T,title:v,width:w}){if(!h&&!d)throw new i("print:layout-required","layout is not set");const _=new k({attributionVisible:t,forceFeatureAttributes:r,format:l,includeTables:m,layout:h,layoutItem:d,layoutOptions:{authorText:e||"",copyrightText:s||"",customTextElements:o,titleText:v||""},outScale:f??0,scalePreserved:T});if(w&&(_.exportOptions.width=w),n&&(_.exportOptions.height=n),a&&(_.exportOptions.dpi=a),_.layoutOptions){u||(_.layoutOptions.legendLayers=[]);const t=this.getLayoutTemplateById(p)?.mapSurroundInfoOptions;if(t){const e=t.northArrow;for(const t of e)Q(_,t,c);const s=t.scaleBar;for(const t of s)Q(_,t,y);const i=t.legend;for(const t of i)Q(_,t,u)}}return _}getLayoutTemplateById(t){return t?this._templateIdToCustomTemplate.get(t):null}async addPortalTemplate(t){if(!this.portal||!t?.id)return;try{t.loaded||await t.load()}catch{return void this.applyTemplate(this.defaultTemplate)}const e=new H({type:"browse-template",layoutInfoTaskUrl:this._portalLayoutInfoTaskUrl,label:t.title,layoutItem:t});this._templateIdToCustomTemplate.set(e.id,e),this.browseTemplates.add(e)}removePortalTemplate(t){t.layoutItem&&this.templateOptions.id===t.layoutItem.id&&(this.defaultTemplate?this.applyTemplate(this.defaultTemplate):this.templateOptions.reset()),this.browseTemplates.remove(t),this._templateIdToCustomTemplate.delete(t.id)}async applyTemplate(t){if(t&&t===this.getLayoutTemplateById(this.templateOptions.id))return;if(this.templateOptions.reset(),!t)return;if("map-only"===t)return void(this.templateOptions.layout="map-only");!t.layout||!this.templatesInfo||this.templatesInfo.layout.choiceList.includes(t.layout)||(this.defaultTemplate?t=this.defaultTemplate:this.templateOptions.reset());const e=t.layout||t.layoutItem?.id,s=e?this.templateCustomTextElements?.[e]:void 0;if(await this.templateOptions.applyTemplate(t,{customTextElements:s,customLayoutOptions:this._customLayoutOptions}),e&&this._serviceTemplateCustomTextElements&&!this._serviceTemplateCustomTextElements[e]&&t.layoutTemplateInfo?.layoutOptions?.customTextElements){const s=a(this._serviceTemplateCustomTextElements);s[e]=t.layoutTemplateInfo.layoutOptions.customTextElements,this._serviceTemplateCustomTextElements=Object.freeze(s)}}createExportedFileLink(t){const e=this.toPrintTemplate(this.templateOptions).format.toLowerCase(),s=e.includes("png")?"png":e,i=t+s;return this._updateExportedFileNameMap(i),new M({name:t,extension:s,count:this._exportedFileNameMap[i]})}export(t){const e=this.createExportedFileLink(t);this.exportedLinks.add(e);const s=this.print(this.toPrintTemplate(this.templateOptions)).then(t=>e.set({url:t?.url,state:"ready"})).catch(t=>e.set({error:t,state:"error"}));return this.emit("submit",{link:e,saveExportEnabled:this.saveExportEnabled}),s.then(t=>this.emit("complete",{link:t,saveExportEnabled:this.saveExportEnabled})),{link:e,promise:s}}async _loadResources(t){this.destroyed||(await this._loadUrls(t),await this._loadTemplateInfos(t),this._updateOverLayItem())}async _loadTemplateInfos(t){const e=[...this.defaultTemplates,...this.printServiceTemplates];for(const{id:o}of e)this._templateIdToCustomTemplate.delete(o);this.defaultTemplates.removeAll(),this.printServiceTemplates.removeAll();const[s,i]=await Promise.all([this._getLayoutToLayoutTemplateInfos(t),this._getPrintServiceTemplatesInfo(t)]);await this._loadAllTemplates(s,i,t),this._processPrintServiceTemplatesInfo(i),await this._processTemplateOptions()}_updateExportedFileNameMap(t){void 0!==this._exportedFileNameMap[t]?this._exportedFileNameMap[t]++:this._exportedFileNameMap[t]=0}async _processTemplateOptions(){const{layout:t,layoutItem:e}=this.templateOptions;if("map-only"!==t)if(this._customLayoutOptions={legend:this.templateOptions.legendEnabled,northArrow:this.templateOptions.northArrowEnabled,scaleBar:this.templateOptions.scaleBarEnabled},e?.id){try{e.loaded||await e.load()}catch{return void this.applyTemplate(this.defaultTemplate)}let t=this._templateIdToCustomTemplate.get(e.id);t||(t=new H({label:e.title,layoutItem:e,layoutInfoTaskUrl:this._portalLayoutInfoTaskUrl}),this._templateIdToCustomTemplate.set(t.id,t)),await this.applyTemplate(t)}else if(t){const t=this.defaultTemplates.find(t=>t.layout===this.templateOptions.layout)??this.printServiceTemplates.find(t=>t.layout===this.templateOptions.layout);await this.applyTemplate(t??this.defaultTemplate)}}async _loadPortal(t){try{await this.portal.load(t)}catch(e){throw new i("print:could-not-load-portal","Cannot load print resource information from portal",{error:e,url:this.effectivePrintServiceUrl})}}async _loadUrls(t){if(this.printServiceUrl)this._set("effectivePrintServiceUrl",this.printServiceUrl),this._layoutInfoTaskUrl=await this._getLayoutInfoTaskUrl(this.effectivePrintServiceUrl,t);else{await this._loadPortal(t);const{printTask:e,asyncPrintTask:s,layoutInfoTask:i}=this.portal?.helperServices??{};this._set("effectivePrintServiceUrl",e?.url),this._asyncPrintTaskUrl=s?.url,this._layoutInfoTaskUrl=await this._getLayoutInfoTaskUrl(this.effectivePrintServiceUrl,t),i?.url&&this.effectivePrintServiceUrl!==i.url?this._portalLayoutInfoTaskUrl=await this._getLayoutInfoTaskUrl(i.url,t):this._portalLayoutInfoTaskUrl=this._layoutInfoTaskUrl}const e=this.effectivePrintServiceUrl?.toLowerCase().split("/");if(!e?.includes("gpserver"))throw new i("print:invalid-print-service-url","Can't fetch print templates information from provided URL",{url:this.effectivePrintServiceUrl})}async _getLayoutInfoTaskUrl(t,e){if(!t)return null;const s=await P(t,"GetLayoutTemplatesInfo",e);return s?t.replace(B,`$1${encodeURI(s.displayName)}`):null}_getPortalDefaultTemplates(t,e){return this.portal?.helperServices?.printTask?.templates?.filter(t=>"map_only"!==t.layout.toLowerCase()&&(!e||e.includes(S(t.layout))))?.map(e=>{const s=H.fromJSON(e);if(s.type="default-template",s.layoutInfoTaskUrl=this._layoutInfoTaskUrl,s.layout){const e=t.get(s.layout);e&&s.setLayoutTemplateInfo(e)}return s})??[]}async _getPortalCustomTemplates(t){if(this.printServiceUrl||!this.portal)return[];const{layoutGroupQuery:e,user:s}=this.portal,i=b.test(this.portal.url),o=s?.userLicenseTypeId,a=o&&V.has(o);if(!e||i&&!a)return[];const r=new O({query:e,disableExtraQuery:!0}),l=await this.portal.queryGroups(r,t);if(!l.total)return[];const n=l.results[0],p=new O({num:100,query:"type:Layout",sortField:n.sortField,sortOrder:n.sortOrder??void 0}),m=(await n.queryItems(p,t)).results;if(!m.length)return[];return m.map(t=>(this.portalTemplateIds.push(t.id),new H({type:"default-template",label:t.title,layoutItem:t,layoutInfoTaskUrl:this._portalLayoutInfoTaskUrl})))}async _loadAllTemplates(t,e,s){let i=!1;const o=e?.layout?.choiceList;if(this.includeDefaultTemplates&&this.portal&&!this.printServiceUrl){const e=this._getPortalDefaultTemplates(t,o);i=!!e.length,this.defaultTemplates.addMany(e);const a=await this._getPortalCustomTemplates(s);this.defaultTemplates.addMany(a);for(const t of this.defaultTemplates)this._templateIdToCustomTemplate.set(t.id,t)}i||t.forEach((t,e)=>{if(!o||o.includes(e)){const s=new H({type:"print-service-template",layout:e,layoutInfoTaskUrl:this._layoutInfoTaskUrl});s.setLayoutTemplateInfo(t),this.printServiceTemplates.add(s),this._templateIdToCustomTemplate.set(s.id,s)}})}_processPrintServiceTemplatesInfo(t){this._set("templatesInfo",t);const e=t?.layout?.defaultValue;if(e&&"map-only"!==e){const t=this.defaultTemplates.find(t=>t.layout===e)??this.printServiceTemplates.find(t=>t.layout===e)??this.defaultTemplates.at(0)??this.printServiceTemplates.at(0);this._set("defaultTemplate",t)}}async _getLayoutToLayoutTemplateInfos(t){const e=this._layoutInfoTaskUrl,s=e?this._layoutTemplateInfosCache.get(e):void 0,i=s??await A(e,void 0,t);s||this._layoutTemplateInfosCache.set(e,i);const o=new Map,a={};for(const r of i){const t=S(r.layoutTemplate);o.set(t,r),a[t]=r.layoutOptions.customTextElements}return this._serviceTemplateCustomTextElements=Object.freeze(a),o}async _getPrintServiceTemplatesInfo(t){const e=this.effectivePrintServiceUrl?this._tasksInfoCache.get(this.effectivePrintServiceUrl):void 0,s=e??await P(this.effectivePrintServiceUrl,"ExportWebMap",t);if(!s)throw new i("print:unavailable-service-info","Can't fetch templates info from service");e||this._tasksInfoCache.set(this.effectivePrintServiceUrl,s);const{parameters:o}=s,a=o.find(({name:t})=>"Format"===t),r=o.find(({name:t})=>"Layout_Template"===t);return{format:this._getFormat(a),layout:this._getLayout(r)}}_getFormat(t){const s="all"===this.allowedFormats?t.choiceList:t.choiceList.filter(t=>"string"!=typeof this.allowedFormats&&this.allowedFormats.some(e=>new RegExp(`\\b${e}\\b`,"i").test(t))),i=(s.length?s:t.choiceList).map(t=>L.fromJSON(t)).filter(e),o=L.fromJSON(t.defaultValue),a=i.some(t=>new RegExp(`\\b${o}\\b`,"i").test(t))?o:i[0];return{choiceList:i,defaultValue:a}}_getLayout(t){const s=t.choiceList.filter(t=>"map_only"!==t.toLowerCase()),i="all"===this.allowedLayouts?s:s.filter(t=>this.allowedLayouts.includes(S(t))),o=(i.length?i:s).map(S).filter(e),a=S(t.defaultValue),r=o.includes(a)?a:o.find(t=>/(?=.*letter)(?=.*landscape)/i.test(t))??o.find(t=>/(?=.*a4)(?=.*landscape)/i.test(t))??o[0];return{choiceList:o,defaultValue:r}}_getOverlayItem(){return this._overlayItem||(this._overlayItem=new F({strokeDash:[5],strokeWidth:2,strokeColor:[30,144,255,255]})),this._overlayItem}_enablePrintPreview(){if(!this.view?.overlay)return;const t=this.templateOptions,e=this._getOverlayItem();this.addHandles([p(()=>[t.width,t.height,t.scaleEnabled,t.scale,t.layout,t.layoutItem,t.id,t.state,t.dpi,this.view?.scale,this.view?.size,this.view?.state.paddedViewState.size,this.view?.state.padding,this.loaded],()=>this._updateOverLayItem(),m),this.view?.on("drag",["Shift"],t=>this._handleDrag(t),j.WIDGET),this.view?.on("key-down",["Escape"],()=>this._resetDrag(),j.WIDGET)],"overlay-handler"),this.view.overlay.addItem(e)}_updateOverLayItem(){if(!this.view)return;const t=this.templateOptions,e=this._getOverlayItem(),s=t.layoutItem?.id??t.layout,i=this.view,o=i.spatialReference,[a,r]=i.state.paddedViewState.size,l=i.state.padding;let n=0,p=0;if("map-only"===s)null!=t.width&&null!=t.height&&(n=t.width,p=t.height);else if(s){const e=t.id?this._templateIdToCustomTemplate.get(t.id):null,{webMapFrameSize:s,pageUnits:i}=e?.layoutTemplateInfo??{};let l=!1;if(s&&i)if(this._isFreeHand){const t=s[0]/s[1];n=this._freeHandWidth,p=this._freehandHeight,n>p?p=n/t:n=p*t}else{const t=W.fromJSON(i.toLowerCase()),e=o.unit;d(t)===d(e)?(n=u(s[0],t,e),p=u(s[1],t,e)):(l=!0,n=s[0],p=s[1])}if(!this._isFreeHand)if(t.scaleEnabled&&t.scale){const e=l?Math.min(a/n,r/p):c(o)*f*t.dpi;n*=e,p*=e}else if(0===n||0===p)n=a,p=r;else{const t=(a-.1*a)/n,e=(r-.1*r)/p,s=Math.min(t,e);n*=s,p*=s}}const{scaleEnabled:m,scale:h}=t,y=m&&h?h/this.view.scale:1,T=m&&h?G/t.dpi:1;if(e.boxWidth=n*y*T||a,e.boxHeight=p*y*T||r,l&&(e.padding=l),e.backgroundWidth=a??0,e.backgroundHeight=r??0,"loading"===this.loadStatus)e.strokeColor=N;else if("loaded"===this.loadStatus)switch(this.templateOptions.state){case"pending":e.strokeColor=N;break;case"ready":e.strokeColor=R;break;case"error":e.strokeColor=z}}_resetDrag(){this._isFreeHand=!1,this._updateOverLayItem()}_handleDrag(t){switch(t.action){case"start":this._start();break;case"update":this._update(t);break;case"end":this._end()}t.stopPropagation()}_start(){this._isFreeHand=!0}_update(t){const e=this._getOverlayItem(),{x:s,y:i}=t,{x:o,y:a}=t.origin;s>o?(e.x=o,e.boxWidth=s-o):(e.x=s,e.boxWidth=o-s),i>a?(e.y=a,e.boxHeight=i-a):(e.y=i,e.boxHeight=a-i)}_end(){const t=this._getOverlayItem();if(!this.view||null==t.x||null==t.y)return;const e=this.view,s=e.toMap(h(t.x+.5*t.boxWidth,t.y+.5*t.boxHeight));t.x=null,t.y=null,e.goTo({center:s}),this._freeHandWidth=t.boxWidth,this._freehandHeight=t.boxHeight,"map-only"===this.templateOptions.layout&&(this.templateOptions.width=this._freeHandWidth,this.templateOptions.height=this._freehandHeight),this.templateOptions.scale=this.view.scale,this._updateOverLayItem()}};t([y()],K.prototype,"_serviceTemplateCustomTextElements",void 0),t([y()],K.prototype,"_templateIdToCustomTemplate",void 0),t([y()],K.prototype,"allowedFormats",void 0),t([y()],K.prototype,"allowedLayouts",void 0),t([y({type:q})],K.prototype,"browseTemplates",void 0),t([y({type:q})],K.prototype,"defaultTemplates",void 0),t([y()],K.prototype,"error",void 0),t([y({type:$})],K.prototype,"exportedLinks",void 0),t([y()],K.prototype,"extraParameters",void 0),t([y()],K.prototype,"includeDefaultTemplates",void 0),t([y({readOnly:!0})],K.prototype,"effectivePrintServiceUrl",null),t([y()],K.prototype,"effectiveTemplateCustomTextElements",null),t([y({type:w})],K.prototype,"outSpatialReference",void 0),t([y({type:x})],K.prototype,"portal",void 0),t([y()],K.prototype,"portalTemplateIds",void 0),t([y({type:q})],K.prototype,"printServiceTemplates",void 0),t([y({readOnly:!0})],K.prototype,"defaultTemplate",void 0),t([y()],K.prototype,"showPrintAreaEnabled",void 0),t([y()],K.prototype,"printServiceUrl",void 0),t([y()],K.prototype,"printTimeout",void 0),t([y()],K.prototype,"saveExportEnabled",void 0),t([y({readOnly:!0})],K.prototype,"state",null),t([y({readOnly:!0})],K.prototype,"templatesInfo",void 0),t([y()],K.prototype,"updateDelay",void 0),t([y()],K.prototype,"view",void 0),t([y()],K.prototype,"templateCustomTextElements",void 0),t([y({type:D})],K.prototype,"templateOptions",void 0),K=t([T("esri.widgets.Print.PrintViewModel")],K);const X=K;export{X as default};
|
|
5
|
+
import{__decorate as t}from"tslib";import{isSome as e}from"../../core/arrayUtils.js";import i from"../../core/Collection.js";import s from"../../core/Error.js";import{EventedAccessor as o}from"../../core/Evented.js";import{JSONMap as a}from"../../core/jsonMap.js";import{clone as r}from"../../core/lang.js";import{LoadableMixin as l}from"../../core/Loadable.js";import{EsriPromiseMixin as n}from"../../core/Promise.js";import p from"../../core/ReactiveMap.js";import{watch as m,initial as h,whenOnce as d}from"../../core/reactiveUtils.js";import{createScreenPoint as u}from"../../core/screenUtils.js";import{unitType as c,convertUnit as f,getMetersPerUnitForSR as y,inchesPerMeter as v}from"../../core/units.js";import{property as T,subclass as w}from"../../core/accessorSupport/decorators.js";import _ from"../../geometry/Extent.js";import I from"../../geometry/SpatialReference.js";import{formatDate as g,convertDateFormatToIntlOptions as x}from"../../intl/date.js";import{getLocaleLanguage as O}from"../../intl/locale.js";import b from"../../portal/Portal.js";import E from"../../portal/PortalQueryParams.js";import{reArcGISOnlineDomain as L}from"../../portal/support/urlUtils.js";import{execute as P,getTaskInfo as S}from"../../rest/print.js";import{formatJsonMap as U}from"../../rest/support/fileFormat.js";import{fromJSON as k}from"../../rest/support/layoutTemplate.js";import C from"../../rest/support/LegendLayer.js";import j from"../../rest/support/PrintParameters.js";import{getVisibleLayerViews as F}from"../../rest/support/printTaskUtils.js";import M from"../../rest/support/PrintTemplate.js";import{getExtent as H}from"../../views/2d/viewpointUtils.js";import{ViewEventPriorities as D}from"../../views/input/InputManager.js";import A from"../../views/overlay/BoxOverlayItem.js";import W from"./CustomTemplate.js";import N from"./FileLink.js";import R from"./TemplateOptions.js";import{fetchLayoutTemplateInfos as V,valueUnitKebabDict as z}from"./utils.js";const B=[30,144,255,255],G=[237,211,23,255],q=[216,48,32,255],$=new Set(["GISProfessionalStdUT","GISProfessionalAdvUT"]),J=/(\/GPServer\/).+/i,Q=96,K=i.ofType(W),X=i.ofType(N),Y=new a({Feet:"feet",Miles:"miles",Meters:"meters",Kilometers:"kilometers"});function Z(t){t.layoutOptions??={},t.layoutOptions.customTextElements??=[];const e="date";if(!t.layoutOptions.customTextElements.find(t=>e in t)){const{customTextElements:e}=t.layoutOptions;let i=g(Date.now(),x("short-date"));"ar"===O()&&(i=""+i),e.push({date:i})}}function tt(t,e,i,s){if(!e.layoutOptions)return;if(!i)return void(e.layoutOptions.legendLayers=[]);if(!t)return;const o=F(t);e.layoutOptions.legendLayers=o.map(t=>new C({layerId:t.layer.id,title:t.layer.title||void 0,dynamicLegend:s}))}function et(t,e,i){if(!e)return;!(e.visible===i)&&t.layoutOptions&&(t.layoutOptions.elementOverrides?t.layoutOptions.elementOverrides[e.name]={visible:i}:t.layoutOptions.elementOverrides={[e.name]:{visible:i}})}let it=class extends(l(n(o))){constructor(t){super(t),this._serviceTemplateCustomTextElements=null,this._templateIdToCustomTemplate=new p,this._isFreeHand=!1,this._freeHandWidth=0,this._freehandHeight=0,this._asyncPrintTaskUrl=null,this._layoutInfoTaskUrl=null,this._portalLayoutInfoTaskUrl=null,this._customLayoutOptions=null,this._exportedFileNameMap={},this._layoutTemplateInfosCache=new Map,this._tasksInfoCache=new Map,this.allowedFormats="all",this.allowedLayouts="all",this.browseTemplates=new K,this.defaultTemplates=new K,this.error=null,this.exportedLinks=new X,this.extraParameters=null,this.includeDefaultTemplates=!0,this.outSpatialReference=null,this.portal=b.getDefault(),this.portalTemplateIds=[],this.printServiceTemplates=new K,this.defaultTemplate=null,this.showPrintAreaEnabled=!1,this.printServiceUrl=null,this.printTimeout=12e4,this.saveExportEnabled=!1,this.templatesInfo=null,this.updateDelay=1e3,this.view=null,this.templateCustomTextElements=null,this.templateOptions=new R}initialize(){this.addHandles([m(()=>[this.showPrintAreaEnabled,this.view],()=>{this.showPrintAreaEnabled?this._enablePrintPreview():(this.removeHandles("overlay-handler"),this.view?.overlay?.removeItem(this._getOverlayItem()))}),m(()=>[this.templateOptions.layout,this.templateOptions.layoutItem],()=>{this.loaded&&this._processTemplateOptions()}),m(()=>[this.allowedFormats,this.allowedLayouts],()=>{this.loaded&&this._loadTemplateInfos()}),m(()=>this.exportedLinks,()=>{for(const{name:t,extension:e}of this.exportedLinks)t&&e&&this._updateExportedFileNameMap(`${t}${e}`)},h)])}destroy(){this.removeHandles("overlay-handler"),this.view&&(this._overlayItem&&(this.view.overlay?.removeItem(this._overlayItem),this._overlayItem.destroy(),this._overlayItem=null),this.view=null)}get effectivePrintServiceUrl(){return this.printServiceUrl??null}get effectiveTemplateCustomTextElements(){if(!this._serviceTemplateCustomTextElements)return{};const t=r(this._serviceTemplateCustomTextElements);return this.templateCustomTextElements&&Object.keys(this.templateCustomTextElements).forEach(e=>{const i=t[e];if(i){const t=this.templateCustomTextElements?.[e];i.forEach(e=>{const[i]=Object.entries(e)[0];t?.forEach(t=>{const[s,o]=Object.entries(t)[0];i===s&&(e[i]=o)})})}}),Object.freeze(t)}get state(){return"loading"===this.loadStatus?"initializing":"failed"===this.loadStatus||this.error?"error":"loaded"===this.loadStatus&&this.view?.ready?"ready":"disabled"}async print(t){const{view:e,extraParameters:i,updateDelay:o,outSpatialReference:a}=this;if(!e)throw new s("print:view-required","view is not set");Z(t);const r=this._getOverlayItem(),l=t.scalePreserved||!this.showPrintAreaEnabled?void 0:H(new _,e.viewpoint,"map-only"===t.layout?[t.exportOptions.width,t.exportOptions.height]:[r.boxWidth,r.boxHeight]),n=new j({view:e,template:t,extent:l,extraParameters:i,updateDelay:o,outSpatialReference:a});try{const e=!!t.layoutItem?.id&&(this.defaultTemplates.some(e=>e.layoutItem?.id===t.layoutItem?.id)||this.browseTemplates.some(e=>e.layoutItem?.id===t.layoutItem?.id));return await P(e&&this._asyncPrintTaskUrl?this._asyncPrintTaskUrl:this.effectivePrintServiceUrl,n,{timeout:this.printTimeout})}catch(p){throw new s("print:export-error","An error occurred while exporting the web map.",{error:p})}}async load(t){return this.addResolvingPromise(this._loadResources(t).catch(t=>this.error=t)),this}toPrintTemplate({attributionEnabled:t,author:e,copyright:i,customTextElements:o,dpi:a,forceFeatureAttributes:r,format:l,height:n,id:p,includeTables:m,layout:h,layoutItem:d,legendEnabled:u,dynamicLegendEnabled:c,northArrowEnabled:f,scale:y,scaleBarEnabled:v,scaleBarUnit:T,scaleEnabled:w,title:_,width:I}){if(!h&&!d)throw new s("print:layout-required","layout is not set");const g=new M({attributionVisible:t,forceFeatureAttributes:r,format:l,includeTables:m,layout:h,layoutItem:d,layoutOptions:{authorText:e||"",copyrightText:i||"",customTextElements:o,titleText:_||"",scalebarUnit:v&&T?Y.toJSON(T):void 0},outScale:y??0,scalePreserved:w});if(I&&(g.exportOptions.width=I),n&&(g.exportOptions.height=n),a&&(g.exportOptions.dpi=a),g.layoutOptions){tt(this.view,g,u,c);const t=this.getLayoutTemplateById(p)?.mapSurroundInfoOptions;if(t){const e=t.northArrow;for(const t of e)et(g,t,f);const i=t.scaleBar;for(const t of i)et(g,t,v);const s=t.legend;for(const t of s)et(g,t,u)}}return g}getLayoutTemplateById(t){return t?this._templateIdToCustomTemplate.get(t):null}async addPortalTemplate(t){if(!this.portal||!t?.id)return;try{if("loading"===this.loadStatus&&await d(()=>this.loaded),!this.loaded)throw new s("print:load-required","PrintViewModel must be loaded before adding portal templates.");t.loaded||await t.load()}catch{return void this.applyTemplate(this.defaultTemplate)}const e=new W({type:"browse-template",layoutInfoTaskUrl:this._portalLayoutInfoTaskUrl,label:t.title,layoutItem:t});this._templateIdToCustomTemplate.set(e.id,e),this.browseTemplates.add(e)}removePortalTemplate(t){t.layoutItem&&this.templateOptions.id===t.layoutItem.id&&(this.defaultTemplate?this.applyTemplate(this.defaultTemplate):this.templateOptions.reset()),this.browseTemplates.remove(t),this._templateIdToCustomTemplate.delete(t.id)}async applyTemplate(t){if(t&&t===this.getLayoutTemplateById(this.templateOptions.id))return;if(this.templateOptions.reset(),!t)return;if("map-only"===t)return void(this.templateOptions.layout="map-only");!t.layout||!this.templatesInfo||this.templatesInfo.layout.choiceList.includes(t.layout)||(this.defaultTemplate?t=this.defaultTemplate:this.templateOptions.reset());const e=t.layout||t.layoutItem?.id,i=e?this.templateCustomTextElements?.[e]:void 0;if(await this.templateOptions.applyTemplate(t,{customTextElements:i,customLayoutOptions:this._customLayoutOptions}),e&&this._serviceTemplateCustomTextElements&&!this._serviceTemplateCustomTextElements[e]&&t.layoutTemplateInfo?.layoutOptions?.customTextElements){const i=r(this._serviceTemplateCustomTextElements);i[e]=t.layoutTemplateInfo.layoutOptions.customTextElements,this._serviceTemplateCustomTextElements=Object.freeze(i)}}createExportedFileLink(t){const e=this.toPrintTemplate(this.templateOptions).format.toLowerCase(),i=e.includes("png")?"png":e,s=t+i;return this._updateExportedFileNameMap(s),new N({name:t,extension:i,count:this._exportedFileNameMap[s]})}export(t){const e=this.createExportedFileLink(t);this.exportedLinks.add(e);const i=this.print(this.toPrintTemplate(this.templateOptions)).then(t=>e.set({url:t?.url,state:"ready"})).catch(t=>e.set({error:t,state:"error"}));return this.emit("submit",{link:e,saveExportEnabled:this.saveExportEnabled}),i.then(t=>this.emit("complete",{link:t,saveExportEnabled:this.saveExportEnabled})),{link:e,promise:i}}async _loadResources(t){this.destroyed||(await this._loadUrls(t),await this._loadTemplateInfos(t),this._updateOverLayItem())}async _loadTemplateInfos(t){const e=[...this.defaultTemplates,...this.printServiceTemplates];for(const{id:o}of e)this._templateIdToCustomTemplate.delete(o);this.defaultTemplates.removeAll(),this.printServiceTemplates.removeAll();const[i,s]=await Promise.all([this._getLayoutToLayoutTemplateInfos(t),this._getPrintServiceTemplatesInfo(t)]);await this._loadAllTemplates(i,s,t),this._processPrintServiceTemplatesInfo(s),await this._processTemplateOptions()}_updateExportedFileNameMap(t){void 0!==this._exportedFileNameMap[t]?this._exportedFileNameMap[t]++:this._exportedFileNameMap[t]=0}async _processTemplateOptions(){const{layout:t,layoutItem:e}=this.templateOptions;if("map-only"!==t)if(this._customLayoutOptions={legend:this.templateOptions.legendEnabled,northArrow:this.templateOptions.northArrowEnabled,scaleBar:this.templateOptions.scaleBarEnabled},e?.id){try{e.loaded||await e.load()}catch{return void this.applyTemplate(this.defaultTemplate)}let t=this._templateIdToCustomTemplate.get(e.id);t||(t=new W({label:e.title,layoutItem:e,layoutInfoTaskUrl:this._portalLayoutInfoTaskUrl}),this._templateIdToCustomTemplate.set(t.id,t)),await this.applyTemplate(t)}else if(t){const t=this.defaultTemplates.find(t=>t.layout===this.templateOptions.layout)??this.printServiceTemplates.find(t=>t.layout===this.templateOptions.layout);await this.applyTemplate(t??this.defaultTemplate)}}async _loadPortal(t){try{await this.portal.load(t)}catch(e){throw new s("print:could-not-load-portal","Cannot load print resource information from portal",{error:e,url:this.effectivePrintServiceUrl})}}async _loadUrls(t){if(this.printServiceUrl)this._set("effectivePrintServiceUrl",this.printServiceUrl),this._layoutInfoTaskUrl=await this._getLayoutInfoTaskUrl(this.effectivePrintServiceUrl,t);else{await this._loadPortal(t);const{printTask:e,asyncPrintTask:i,layoutInfoTask:s}=this.portal?.helperServices??{};this._set("effectivePrintServiceUrl",e?.url),this._asyncPrintTaskUrl=i?.url,this._layoutInfoTaskUrl=await this._getLayoutInfoTaskUrl(this.effectivePrintServiceUrl,t),s?.url&&this.effectivePrintServiceUrl!==s.url?this._portalLayoutInfoTaskUrl=await this._getLayoutInfoTaskUrl(s.url,t):this._portalLayoutInfoTaskUrl=this._layoutInfoTaskUrl}const e=this.effectivePrintServiceUrl?.toLowerCase().split("/");if(!e?.includes("gpserver"))throw new s("print:invalid-print-service-url","Can't fetch print templates information from provided URL",{url:this.effectivePrintServiceUrl})}async _getLayoutInfoTaskUrl(t,e){if(!t)return null;const i=await S(t,"GetLayoutTemplatesInfo",e);return i?t.replace(J,`$1${encodeURI(i.displayName)}`):null}_getPortalDefaultTemplates(t,e){return this.portal?.helperServices?.printTask?.templates?.filter(t=>"map_only"!==t.layout.toLowerCase()&&(!e||e.includes(k(t.layout))))?.map(e=>{const i=W.fromJSON(e);if(i.type="default-template",i.layoutInfoTaskUrl=this._layoutInfoTaskUrl,i.layout){const e=t.get(i.layout);e&&i.setLayoutTemplateInfo(e)}return i})??[]}async _getPortalCustomTemplates(t){if(this.printServiceUrl||!this.portal)return[];const{layoutGroupQuery:e,user:i}=this.portal,s=L.test(this.portal.url),o=i?.userLicenseTypeId,a=o&&$.has(o);if(!e||s&&!a)return[];const r=new E({query:e,disableExtraQuery:!0}),l=await this.portal.queryGroups(r,t);if(!l.total)return[];const n=l.results[0],p=new E({num:100,query:"type:Layout",sortField:n.sortField,sortOrder:n.sortOrder??void 0}),m=(await n.queryItems(p,t)).results;if(!m.length)return[];return m.map(t=>(this.portalTemplateIds.push(t.id),new W({type:"default-template",label:t.title,layoutItem:t,layoutInfoTaskUrl:this._portalLayoutInfoTaskUrl})))}async _loadAllTemplates(t,e,i){let s=!1;const o=e?.layout?.choiceList;if(this.includeDefaultTemplates&&this.portal&&!this.printServiceUrl){const e=this._getPortalDefaultTemplates(t,o);s=!!e.length,this.defaultTemplates.addMany(e);const a=await this._getPortalCustomTemplates(i);this.defaultTemplates.addMany(a);for(const t of this.defaultTemplates)this._templateIdToCustomTemplate.set(t.id,t)}s||t.forEach((t,e)=>{if(!o||o.includes(e)){const i=new W({type:"print-service-template",layout:e,layoutInfoTaskUrl:this._layoutInfoTaskUrl});i.setLayoutTemplateInfo(t),this.printServiceTemplates.add(i),this._templateIdToCustomTemplate.set(i.id,i)}})}_processPrintServiceTemplatesInfo(t){this._set("templatesInfo",t);const e=t?.layout?.defaultValue;if(e&&"map-only"!==e){const t=this.defaultTemplates.find(t=>t.layout===e)??this.printServiceTemplates.find(t=>t.layout===e)??this.defaultTemplates.at(0)??this.printServiceTemplates.at(0);this._set("defaultTemplate",t)}}async _getLayoutToLayoutTemplateInfos(t){const e=this._layoutInfoTaskUrl,i=e?this._layoutTemplateInfosCache.get(e):void 0,s=i??await V(e,void 0,t);i||this._layoutTemplateInfosCache.set(e,s);const o=new Map,a={};for(const r of s){const t=k(r.layoutTemplate);o.set(t,r),a[t]=r.layoutOptions.customTextElements}return this._serviceTemplateCustomTextElements=Object.freeze(a),o}async _getPrintServiceTemplatesInfo(t){const e=this.effectivePrintServiceUrl?this._tasksInfoCache.get(this.effectivePrintServiceUrl):void 0,i=e??await S(this.effectivePrintServiceUrl,"ExportWebMap",t);if(!i)throw new s("print:unavailable-service-info","Can't fetch templates info from service");e||this._tasksInfoCache.set(this.effectivePrintServiceUrl,i);const{parameters:o}=i,a=o.find(({name:t})=>"Format"===t),r=o.find(({name:t})=>"Layout_Template"===t);return{format:this._getFormat(a),layout:this._getLayout(r)}}_getFormat(t){const i="all"===this.allowedFormats?t.choiceList:t.choiceList.filter(t=>"string"!=typeof this.allowedFormats&&this.allowedFormats.some(e=>new RegExp(`\\b${e}\\b`,"i").test(t))),s=(i.length?i:t.choiceList).map(t=>U.fromJSON(t)).filter(e),o=U.fromJSON(t.defaultValue),a=s.some(t=>new RegExp(`\\b${o}\\b`,"i").test(t))?o:s[0];return{choiceList:s,defaultValue:a}}_getLayout(t){const i=t.choiceList.filter(t=>"map_only"!==t.toLowerCase()),s="all"===this.allowedLayouts?i:i.filter(t=>this.allowedLayouts.includes(k(t))),o=(s.length?s:i).map(k).filter(e),a=k(t.defaultValue),r=o.includes(a)?a:o.find(t=>/(?=.*letter)(?=.*landscape)/i.test(t))??o.find(t=>/(?=.*a4)(?=.*landscape)/i.test(t))??o[0];return{choiceList:o,defaultValue:r}}_getOverlayItem(){return this._overlayItem||(this._overlayItem=new A({strokeDash:[5],strokeWidth:2,strokeColor:[30,144,255,255]})),this._overlayItem}_enablePrintPreview(){if(!this.view?.overlay)return;const t=this.templateOptions,e=this._getOverlayItem();this.addHandles([m(()=>[t.width,t.height,t.scaleEnabled,t.scale,t.layout,t.layoutItem,t.id,t.state,t.dpi,this.view?.scale,this.view?.size,this.view?.state.paddedViewState.size,this.view?.state.padding,this.loaded],()=>this._updateOverLayItem(),h),this.view?.on("drag",["Shift"],t=>this._handleDrag(t),D.WIDGET),this.view?.on("key-down",["Escape"],()=>this._resetDrag(),D.WIDGET)],"overlay-handler"),this.view.overlay.addItem(e)}_updateOverLayItem(){if(!this.view)return;const t=this.templateOptions,e=this._getOverlayItem(),i=t.layoutItem?.id??t.layout,s=this.view,o=s.spatialReference,[a,r]=s.state.paddedViewState.size,l=s.state.padding;let n=0,p=0;if("map-only"===i)null!=t.width&&null!=t.height&&(n=t.width,p=t.height);else if(i){const e=t.id?this._templateIdToCustomTemplate.get(t.id):null,{webMapFrameSize:i,pageUnits:s}=e?.layoutTemplateInfo??{};let l=!1;if(i&&s)if(this._isFreeHand){const t=i[0]/i[1];n=this._freeHandWidth,p=this._freehandHeight,n>p?p=n/t:n=p*t}else{const t=z.fromJSON(s.toLowerCase()),e=o.unit;c(t)===c(e)?(n=f(i[0],t,e),p=f(i[1],t,e)):(l=!0,n=i[0],p=i[1])}if(!this._isFreeHand)if(t.scaleEnabled&&t.scale){const t=l?Math.min(a/n,r/p):y(o)*v*Q;n*=t,p*=t}else if(0===n||0===p)n=a,p=r;else{const t=(a-.1*a)/n,e=(r-.1*r)/p,i=Math.min(t,e);n*=i,p*=i}}const{scaleEnabled:m,scale:h}=t,d=m&&h?h/this.view.scale:1;if(e.boxWidth=n*d||a,e.boxHeight=p*d||r,l&&(e.padding=l),e.backgroundWidth=a??0,e.backgroundHeight=r??0,"loading"===this.loadStatus)e.strokeColor=G;else if("loaded"===this.loadStatus)switch(this.templateOptions.state){case"pending":e.strokeColor=G;break;case"ready":e.strokeColor=B;break;case"error":e.strokeColor=q}}_resetDrag(){this._isFreeHand=!1,this._updateOverLayItem()}_handleDrag(t){switch(t.action){case"start":this._start();break;case"update":this._update(t);break;case"end":this._end()}t.stopPropagation()}_start(){this._isFreeHand=!0}_update(t){const e=this._getOverlayItem(),{x:i,y:s}=t,{x:o,y:a}=t.origin;i>o?(e.x=o,e.boxWidth=i-o):(e.x=i,e.boxWidth=o-i),s>a?(e.y=a,e.boxHeight=s-a):(e.y=s,e.boxHeight=a-s)}_end(){const t=this._getOverlayItem();if(!this.view||null==t.x||null==t.y)return;const e=this.view,i=e.toMap(u(t.x+.5*t.boxWidth,t.y+.5*t.boxHeight));t.x=null,t.y=null,e.goTo({center:i}),this._freeHandWidth=t.boxWidth,this._freehandHeight=t.boxHeight,"map-only"===this.templateOptions.layout&&(this.templateOptions.width=this._freeHandWidth,this.templateOptions.height=this._freehandHeight),this.templateOptions.scale=this.view.scale,this._updateOverLayItem()}};t([T()],it.prototype,"_serviceTemplateCustomTextElements",void 0),t([T()],it.prototype,"_templateIdToCustomTemplate",void 0),t([T()],it.prototype,"allowedFormats",void 0),t([T()],it.prototype,"allowedLayouts",void 0),t([T({type:K})],it.prototype,"browseTemplates",void 0),t([T({type:K})],it.prototype,"defaultTemplates",void 0),t([T()],it.prototype,"error",void 0),t([T({type:X})],it.prototype,"exportedLinks",void 0),t([T()],it.prototype,"extraParameters",void 0),t([T()],it.prototype,"includeDefaultTemplates",void 0),t([T({readOnly:!0})],it.prototype,"effectivePrintServiceUrl",null),t([T()],it.prototype,"effectiveTemplateCustomTextElements",null),t([T({type:I})],it.prototype,"outSpatialReference",void 0),t([T({type:b})],it.prototype,"portal",void 0),t([T()],it.prototype,"portalTemplateIds",void 0),t([T({type:K})],it.prototype,"printServiceTemplates",void 0),t([T({readOnly:!0})],it.prototype,"defaultTemplate",void 0),t([T()],it.prototype,"showPrintAreaEnabled",void 0),t([T()],it.prototype,"printServiceUrl",void 0),t([T()],it.prototype,"printTimeout",void 0),t([T()],it.prototype,"saveExportEnabled",void 0),t([T({readOnly:!0})],it.prototype,"state",null),t([T({readOnly:!0})],it.prototype,"templatesInfo",void 0),t([T()],it.prototype,"updateDelay",void 0),t([T()],it.prototype,"view",void 0),t([T()],it.prototype,"templateCustomTextElements",void 0),t([T({type:R})],it.prototype,"templateOptions",void 0),it=t([w("esri.widgets.Print.PrintViewModel")],it);const st=it;export{st as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../core/Accessor.js";import{clone as o}from"../../core/lang.js";import{property as r,subclass as l}from"../../core/accessorSupport/decorators.js";import i from"../../portal/PortalItem.js";let s=class extends e{constructor(t){super(t),this._abortController=null,this.attributionEnabled=!0,this.author=null,this.copyright=null,this.customTextElements=null,this.dpi=96,this.dynamicLegendEnabled=void 0,this.fileName=null,this.forceFeatureAttributes=!1,this.format="pdf",this.height=null,this.includeTables=!0,this.id=null,this.state="ready",this.layout="letter-ansi-a-landscape",this.layoutItem=null,this.legendEnabled=void 0,this.northArrowEnabled=void 0,this.scale=null,this.scaleBarEnabled=void 0,this.scaleBarUnit=null,this.scaleEnabled=!1,this.title=null,this.width=null}async applyTemplate(t,e){if(t?.id===this.id&&"error"!==t?.state)return;if(this._abortController&&(this._abortController.abort(),this._abortController=null),!t)return;if(this._set("state","pending"),this._resetMapSurroundInfoOptions(),this._set("id",t.id),this.set({layout:t.layout,layoutItem:t.layoutItem}),!t.layoutOptions&&t.layoutItem){const e=new AbortController;if(this._abortController=e,await t.fetchLayoutItemTemplateInfo({signal:this._abortController.signal}),"loaded"!==t.state){if("error"===t.state&&this._set("state","error"),this._abortController!==e)return;return void(this._abortController=null)}this._abortController=null}const r=e?.customLayoutOptions,l=e?.customTextElements??t.layoutTemplateInfo?.layoutOptions?.customTextElements??this.customTextElements;this.set({customTextElements:l?o(l):void 0,format:this.format??t.format,legendEnabled:r?.legend??t.layoutOptions?.legend??this.legendEnabled,dynamicLegendEnabled:r?.dynamicLegend??t.layoutOptions?.dynamicLegend??this.dynamicLegendEnabled,northArrowEnabled:r?.northArrow??t.layoutOptions?.northArrow??this.northArrowEnabled,scaleBarEnabled:r?.scaleBar??t.layoutOptions?.scaleBar??this.scaleBarEnabled}),this._set("state","ready")}reset(){this._set("id",null),this._set("state","ready"),this.set({layout:null,layoutItem:null,customTextElements:null}),this._resetMapSurroundInfoOptions()}_resetMapSurroundInfoOptions(){this.set({legendEnabled:void 0,dynamicLegendEnabled:void 0,northArrowEnabled:void 0,scaleBarEnabled:void 0})}};t([r()],s.prototype,"attributionEnabled",void 0),t([r()],s.prototype,"author",void 0),t([r()],s.prototype,"copyright",void 0),t([r()],s.prototype,"customTextElements",void 0),t([r()],s.prototype,"dpi",void 0),t([r()],s.prototype,"dynamicLegendEnabled",void 0),t([r()],s.prototype,"fileName",void 0),t([r()],s.prototype,"forceFeatureAttributes",void 0),t([r()],s.prototype,"format",void 0),t([r()],s.prototype,"height",void 0),t([r()],s.prototype,"includeTables",void 0),t([r({readOnly:!0})],s.prototype,"id",void 0),t([r({readOnly:!0})],s.prototype,"state",void 0),t([r()],s.prototype,"layout",void 0),t([r({type:i})],s.prototype,"layoutItem",void 0),t([r()],s.prototype,"legendEnabled",void 0),t([r()],s.prototype,"northArrowEnabled",void 0),t([r()],s.prototype,"scale",void 0),t([r()],s.prototype,"scaleBarEnabled",void 0),t([r()],s.prototype,"scaleBarUnit",void 0),t([r()],s.prototype,"scaleEnabled",void 0),t([r()],s.prototype,"title",void 0),t([r()],s.prototype,"width",void 0),s=t([l("esri.widgets.Print.TemplateOptions")],s);const a=s;export{a as default};
|