@arcgis/core 5.0.0-next.31 → 5.0.0-next.33
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/applications/SceneViewer/sceneViewerUtils.d.ts +3 -0
- package/applications/SceneViewer/sceneViewerUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/1dd867fa7c58c06b79ea.js +1 -0
- package/assets/esri/core/workers/chunks/22d66d1c8dfccdbbcf30.js +1 -0
- package/assets/esri/core/workers/chunks/22f745539ca54d8cd30d.js +1 -0
- package/assets/esri/core/workers/chunks/2613e482450b57f2d4f5.js +1 -0
- package/assets/esri/core/workers/chunks/27bd88e1101873d4ce12.js +1 -0
- package/assets/esri/core/workers/chunks/{1dfca37f95f2b968aa54.js → 39d2b540738431adec98.js} +1 -1
- package/assets/esri/core/workers/chunks/{5f2cf73fb2944f82661d.js → 433d249c35c56bf15806.js} +34 -34
- package/assets/esri/core/workers/chunks/446f76356fc116204ec3.js +1 -0
- package/assets/esri/core/workers/chunks/44b6b7418cbf7f778bef.js +1 -0
- package/assets/esri/core/workers/chunks/4675ed3ca3e0104d00bf.js +1 -0
- package/assets/esri/core/workers/chunks/4df7cc3477bc46fc39af.js +1 -0
- package/assets/esri/core/workers/chunks/52ecbaa2d32692d6d8df.js +1 -0
- package/assets/esri/core/workers/chunks/{3777b41b4fa2f1418402.js → 55818fe7a7aa1e5c8bbd.js} +1 -1
- package/assets/esri/core/workers/chunks/{7e6fae3660e7a6a0fa16.js → 5f781ef46ce7c4048c2f.js} +1 -1
- package/assets/esri/core/workers/chunks/63933cbcb5c12df09715.js +1 -0
- package/assets/esri/core/workers/chunks/706423d801fa9cbf2e90.js +1 -0
- package/assets/esri/core/workers/chunks/{e6df4327ac1d9b65b80d.js → 71dd80231ea656a6380c.js} +1 -1
- package/assets/esri/core/workers/chunks/725819839434c59102f3.js +1 -0
- package/assets/esri/core/workers/chunks/72cebf18da5ec5eeb666.js +1 -0
- package/assets/esri/core/workers/chunks/{bd58c027408dc858f23c.js → 77b45957cfe42523c1c8.js} +1 -1
- package/assets/esri/core/workers/chunks/{b2fbb44e219232e61cbd.js → 794960ec36e11f4416c2.js} +1 -1
- package/assets/esri/core/workers/chunks/852de585a72d902344a6.js +1 -0
- package/assets/esri/core/workers/chunks/{25fd0884dd14973c89f5.js → 866a608d489bf56bc371.js} +1 -1
- package/assets/esri/core/workers/chunks/871dd5e1f016a04b8d98.js +1 -0
- package/assets/esri/core/workers/chunks/892c417f5130b003889d.js +1 -0
- package/assets/esri/core/workers/chunks/{0bfb7db0a151a5e85dd1.js → 8ad6595ad44c2d60c1ce.js} +1 -1
- package/assets/esri/core/workers/chunks/907083c427d7fb4354e9.js +1 -0
- package/assets/esri/core/workers/chunks/{11bb437437272d8f3e2c.js → 9252854b512237b6a0ef.js} +1 -1
- package/assets/esri/core/workers/chunks/{e615983fab688d515205.js → 944dfa9309da8f49a616.js} +1 -1
- package/assets/esri/core/workers/chunks/{f2f4e34247882eceb50d.js → a2cee5ac0d4df0108425.js} +3 -3
- package/assets/esri/core/workers/chunks/a4b7ba8aec109beb5b4d.js +1 -0
- package/assets/esri/core/workers/chunks/{3bacd904cd93c8013f6a.js → ae793d814cf32db9fbde.js} +1 -1
- package/assets/esri/core/workers/chunks/{e0b70652da4a7f672cfc.js → b21cf62652ca772108c8.js} +1 -1
- package/assets/esri/core/workers/chunks/c2596f48b37092dd566c.js +1 -0
- package/assets/esri/core/workers/chunks/c82a974c8448407885e6.js +1 -0
- package/assets/esri/core/workers/chunks/c9c2e00fed979c21e2f0.js +1 -0
- package/assets/esri/core/workers/chunks/{94005916d321c879bea1.js → cb500d673ca7ec1ef945.js} +1 -1
- package/assets/esri/core/workers/chunks/d239a4ef60e348cfb05a.js +1 -0
- package/assets/esri/core/workers/chunks/d6d03f22c91f528b97e5.js +1 -0
- package/assets/esri/core/workers/chunks/{4ab89c990a82c745c0fd.js → d764b6273974f4bca31b.js} +1 -1
- package/assets/esri/core/workers/chunks/d86e59da76eea888ba86.js +1 -0
- package/assets/esri/core/workers/chunks/da517b4b07d4d27ce94c.js +1 -0
- package/assets/esri/core/workers/chunks/dc3a4ad62bc041a4f899.js +1 -0
- package/assets/esri/core/workers/chunks/defc6b50df5018bd9e86.js +1 -0
- package/assets/esri/core/workers/chunks/df458ad51be27df3d79d.js +1 -0
- package/assets/esri/core/workers/chunks/{01b8e680befff83e7d3e.js → e093e745708f722bc1b9.js} +1 -1
- package/assets/esri/core/workers/chunks/e32fc0b2c6530d28ce85.js +1 -0
- package/assets/esri/core/workers/chunks/e3a994587f9b2e88db85.js +1 -0
- package/assets/esri/core/workers/chunks/ea5bf896acfcc3106bf5.js +1 -0
- package/assets/esri/core/workers/chunks/ed1dabed10ff9f4e0369.js +1 -0
- package/assets/esri/core/workers/chunks/{a74e6d505a55ed27f004.js → f11453f24c0b728669d2.js} +1 -1
- package/assets/esri/core/workers/chunks/f2ebd6471e1259a6eac0.js +1 -0
- package/assets/esri/core/workers/chunks/{14dc21fe66c7b98fb456.js → f3127bdf28a1d9b8db27.js} +1 -1
- package/assets/esri/core/workers/chunks/f3c232fc56a29d51196a.js +1 -0
- package/assets/esri/core/workers/chunks/fee942ef802a162e0248.js +1 -0
- package/assets/esri/themes/base/widgets/_Attribution.scss +8 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/BlendLayers.glsl.js +1 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/GaussianSplat.glsl.js +2 -2
- package/chunks/Geometry.js +1 -1
- package/chunks/GlowComposition.glsl.js +5 -5
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/Point2D.js +1 -1
- package/chunks/UnitFactory.js +1 -1
- package/config.js +1 -1
- package/core/deprecate.js +1 -1
- package/core/keyboard.js +5 -0
- package/geometry/SpatialReference.js +1 -1
- package/geometry/operators/support/apiConverter.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/support/spatialReferenceUtils.js +1 -1
- package/interfaces.d.ts +552 -3
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/catalog/CatalogDynamicGroupLayer.js +1 -1
- package/layers/graphics/data/AttributesBuilder.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/support/LocateSetting.d.ts +4 -0
- package/rest/support/LocateSetting.js +5 -0
- package/rest/support/LocateSettingBase.d.ts +4 -0
- package/rest/support/LocateSettingBase.js +5 -0
- package/rest/support/LocateSettingSource.d.ts +4 -0
- package/rest/support/LocateSettingSource.js +5 -0
- package/rest/support/LocateSettings.d.ts +4 -0
- package/rest/support/LocateSettings.js +5 -0
- package/rest/support/LocateSettingsOverrides.d.ts +4 -0
- package/rest/support/LocateSettingsOverrides.js +5 -0
- package/rest/support/RouteParameters.js +1 -1
- package/statistics/utils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/SymbolRepository.js +1 -1
- package/views/2d/engine/vectorTiles/shaders/sources/shaderRepository.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
- package/views/3d/layers/graphics/LabelDeconflictor.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
- package/views/3d/state/ConstraintsManager.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/support/Attribution3D.js +5 -0
- package/views/3d/support/CombinedElevationProvider.js +1 -1
- package/views/3d/support/ElevationRange.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +5 -0
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +5 -0
- package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
- package/views/3d/terrain/ElevationBounds.js +1 -1
- package/views/3d/terrain/ElevationData.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TileBlendTechniqueConfiguration.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +12 -12
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentDataConstants.js +5 -0
- package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +10 -13
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +7 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowCompositionTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowPresets.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/BufferManager.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFields.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferLayout.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js +4 -4
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +24 -31
- package/views/Attribution.js +5 -0
- package/views/DOMContainer.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/View.js +1 -1
- package/views/draw/support/managers/DrawTooltipManager.js +5 -0
- package/views/interactive/tooltip/content/TooltipContentDynamic.js +5 -0
- package/views/interactive/tooltip/content/tooltipContentFactory.js +1 -1
- package/views/interactive/tooltip/fields/TooltipField.js +1 -1
- package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +5 -0
- package/views/layers/LayerView.js +1 -1
- package/views/support/AttributionItem.d.ts +4 -0
- package/views/support/AttributionItem.js +5 -0
- package/views/support/GroundElevationSampler.js +1 -1
- package/views/support/LayerViewManager.js +1 -1
- package/views/support/attributionUtils.js +5 -0
- package/views/support/geodesicAreaMeasurementUtils.js +1 -1
- package/views/support/geodesicLengthMeasurementUtils.js +1 -1
- package/views/ui/2d/DefaultUI2D.js +1 -1
- package/views/ui/3d/DefaultUI3D.js +1 -1
- package/widgets/Attribution/AttributionViewModel.js +1 -1
- package/widgets/Attribution.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLine.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
- package/widgets/ElevationProfile.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/Widget.js +1 -1
- package/widgets/support/decorators/accessibleHandler.js +1 -1
- package/widgets/support/jsxWidgetSupport.js +1 -1
- package/widgets/support/widget.js +1 -1
- package/widgets/support/widgetUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0a1df5a724fe253b3866.js +0 -1
- package/assets/esri/core/workers/chunks/155d74b9c0ef31dc2316.js +0 -1
- package/assets/esri/core/workers/chunks/25143b919e75d5d2da05.js +0 -1
- package/assets/esri/core/workers/chunks/2c8c48433b380da59831.js +0 -1
- package/assets/esri/core/workers/chunks/2d17ed5321ca05acb8e3.js +0 -1
- package/assets/esri/core/workers/chunks/31b5747a254d13acc58e.js +0 -1
- package/assets/esri/core/workers/chunks/3ac84e324d212815e252.js +0 -1
- package/assets/esri/core/workers/chunks/41a00c77e6f7ce61e476.js +0 -1
- package/assets/esri/core/workers/chunks/447b53a9280b2b19b7a6.js +0 -1
- package/assets/esri/core/workers/chunks/45729d006db6a569715f.js +0 -1
- package/assets/esri/core/workers/chunks/50cf3cbcad2be1c1e210.js +0 -1
- package/assets/esri/core/workers/chunks/565358ea8d1bdc4d1ebc.js +0 -1
- package/assets/esri/core/workers/chunks/592afe1a41bed3b0cc31.js +0 -1
- package/assets/esri/core/workers/chunks/5aeda8a1f2ccabfdf40f.js +0 -1
- package/assets/esri/core/workers/chunks/657d9e5145da1306ace8.js +0 -1
- package/assets/esri/core/workers/chunks/6ce7ca6bebdc61d8eada.js +0 -1
- package/assets/esri/core/workers/chunks/7f7a81ed8893ab649af7.js +0 -1
- package/assets/esri/core/workers/chunks/7ffef8a19166f6b564d8.js +0 -1
- package/assets/esri/core/workers/chunks/819781a209608dcdd678.js +0 -1
- package/assets/esri/core/workers/chunks/8d57e3a0e5687ce15557.js +0 -1
- package/assets/esri/core/workers/chunks/8e9a5d38da40702def80.js +0 -1
- package/assets/esri/core/workers/chunks/8fbda0b85731ac77e1d8.js +0 -1
- package/assets/esri/core/workers/chunks/98c32d10a2344cd7a50b.js +0 -1
- package/assets/esri/core/workers/chunks/aac313257a8b1ae75b75.js +0 -1
- package/assets/esri/core/workers/chunks/be06c8a58c217a17451b.js +0 -1
- package/assets/esri/core/workers/chunks/d56548a994753b08403c.js +0 -1
- package/assets/esri/core/workers/chunks/d5b464ff83ce29b51968.js +0 -1
- package/assets/esri/core/workers/chunks/d777d7cb8df3f21ac97e.js +0 -1
- package/assets/esri/core/workers/chunks/dd95e679618b7b21a7b1.js +0 -1
- package/assets/esri/core/workers/chunks/e08a1934d98e7324776d.js +0 -1
- package/assets/esri/core/workers/chunks/e5deb72df8b2505fd325.js +0 -1
- package/assets/esri/core/workers/chunks/e689a4849f5af3f2f641.js +0 -1
- package/assets/esri/core/workers/chunks/f259ad785ce3aa970792.js +0 -1
- package/assets/esri/core/workers/chunks/f4919950a9a3703d9da3.js +0 -1
- package/assets/esri/core/workers/chunks/f6ce485c082d0d640b01.js +0 -1
- package/assets/esri/core/workers/chunks/fd9ef4b8c969962cf72b.js +0 -1
- package/layers/support/attributionUtils.js +0 -5
|
@@ -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 i from"../../../../core/Accessor.js";import{generateUUID as l}from"../../../../core/uuid.js";import{property as o,subclass as e}from"../../../../core/accessorSupport/decorators.js";let s=class extends i{constructor(t){super(t),this.actual=null,this.lockable=!0,this.id=l(),this.inputValue=null,this.readOnly=!1,this.suffix=null,this.visible=!0,this.invalid=!1,this.unlockOnVertexPlacement=!0,this.displayOrder=0}get committed(){return this.lockable?this._get("committed"):null}set committed(t){this.lockable&&this._set("committed",t)}get dirty(){return null!=this.inputValue}get disabled(){return null==this.actual&&!this.dirty&&!this.locked}get locked(){return this.lockable&&null!=this.committed}onInput(t){this.inputValue=t,this.invalid=!1}onCommit(t,i,l){this.lockable?this._onCommitLockable(t,l):this._onCommitNonLockable(l),this.invalid&&"commit-and-exit"===t||l.onCommit(i,t)}_onCommitLockable(t,i){const{inputValue:l,locked:o}=this;o&&n(l)?this.unlock():("commit-and-exit"===t&&!o||null!=l)&&this._parseInputAndLock(i)}_onCommitNonLockable(t){const{inputValue:i}=this;n(i)?this.lockable?this.setActual(null):this.clearInputValue():null!=i&&this._parseInputAndSetActual(t)}applyValue(t){this.lockable?this.lock(t):this.setActual(t)}clearInputValue(){this.inputValue=null,this.invalid=!1}setActual(t){this.actual=t,this.clearInputValue()}lock(t){this.lockable&&(this.committed=t??this.actual,this.clearInputValue())}unlock(){this.lockable&&(this.committed=null,this.clearInputValue())}toggleLock(t){this.lockable&&(this.locked?this.unlock():this._parseInputAndLock(t))}getSuffix(t){const{suffix:i}=this;return"function"==typeof i?i(t):i}getFormattedValue(t){const{actual:i,committed:l,format:o}=this;return null!=l?o(l,t):null!=i?o(i,t):null}getRawDisplayValue(t){const{actual:i,committed:l,inputValue:o}=this;return null!=o?o:this.lockable&&null!=l?this.formatForInputMode(l,t):null!=i?this.formatForInputMode(i,t):null}_parseInputAndSetActual(t){const{inputValue:i}=this;if(null==i||n(i))return this.setActual(null);const l=this.parse(i,t);null!=l?this.setActual(l):this.invalid=!0}_parseInputAndLock(t){const{inputValue:i,actual:l}=this;if(n(i))return this.unlock();if(null==i)return this.lock(l);const o=this.parse(i,t);null!=o?this.lock(o):this.invalid=!0}};function n(t){return null!=t&&""===t.trim()}t([o()],s.prototype,"actual",void 0),t([o()],s.prototype,"committed",null),t([o()],s.prototype,"dirty",null),t([o()],s.prototype,"disabled",null),t([o()],s.prototype,"format",void 0),t([o()],s.prototype,"formatForInputMode",void 0),t([o()],s.prototype,"lockable",void 0),t([o()],s.prototype,"locked",null),t([o()],s.prototype,"id",void 0),t([o()],s.prototype,"inputValue",void 0),t([o()],s.prototype,"name",void 0),t([o()],s.prototype,"parse",void 0),t([o()],s.prototype,"readOnly",void 0),t([o()],s.prototype,"suffix",void 0),t([o()],s.prototype,"title",void 0),t([o()],s.prototype,"visible",void 0),t([o()],s.prototype,"invalid",void 0),t([o()],s.prototype,"unlockOnVertexPlacement",void 0),t([o()],s.prototype,"displayOrder",void 0),s=t([e("esri.views.interactive.tooltip.fields.TooltipField")],s);export{s as TooltipField};
|
|
@@ -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 e}from"tslib";import{property as t,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{SketchTooltipInfo as s}from"./SketchTooltipInfo.js";let n=class extends s{constructor(e){super(e),this.type="dynamic",this.xyMode="direction-distance",this._isVisibleField=e=>{switch(e.name){case"x":case"y":return this.visibleElements.coordinates;default:return this.visibleElements[e.name]}}}get availableFields(){return this.getAllFields?.()??[]}get elevation(){return this.allFields.find(e=>"elevation"===e.name)}get allFields(){const{availableFields:e,_useCoordinateDisplay:t,_useDirectionDistanceDisplay:i}=this;return(t?e.filter(l):i?e.filter(r):e).filter(this._isVisibleField).sort(o)}get knownConstraintFields(){return this.allFields.filter(a)}get _useCoordinateDisplay(){const{availableFields:e,xyMode:t}=this;return"coordinates"===t&&e.some(e=>"x"===e.name)&&e.some(e=>"y"===e.name)}get _useDirectionDistanceDisplay(){const{availableFields:e,xyMode:t}=this;return"direction-distance"===t&&e.some(e=>"distance"===e.name)&&e.some(e=>"direction"===e.name)}};function o(e,t){return e.displayOrder-t.displayOrder}function l(e){return"direction"!==e.name&&"distance"!==e.name}function r(e){return"x"!==e.name&&"y"!==e.name}function a(e){switch(e.name){case"direction":case"distance":case"elevation":case"x":case"y":return!0;default:return!1}}e([t()],n.prototype,"type",void 0),e([t()],n.prototype,"xyMode",void 0),e([t()],n.prototype,"getAllFields",void 0),e([t()],n.prototype,"availableFields",null),e([t()],n.prototype,"elevation",null),e([t()],n.prototype,"allFields",null),e([t()],n.prototype,"knownConstraintFields",null),e([t()],n.prototype,"_useCoordinateDisplay",null),e([t()],n.prototype,"_useDirectionDistanceDisplay",null),n=e([i("esri.views.interactive.tooltip.infos.DynamicTooltipInfo")],n);export{n as DynamicTooltipInfo};
|
|
@@ -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
|
|
5
|
+
import{__decorate as t}from"tslib";import{createTask as e}from"../../core/asyncUtils.js";import{EventedAccessor as i}from"../../core/Evented.js";import{IdentifiableMixin as r}from"../../core/Identifiable.js";import s from"../../core/Logger.js";import{destroyMaybe as n,removeMaybe as a}from"../../core/maybe.js";import{EsriPromiseMixin as l}from"../../core/Promise.js";import{throwIfAborted as o}from"../../core/promiseUtils.js";import{property as u,subclass as p}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as d}from"../../core/support/UpdatingHandles.js";import{getAttributionItemFromUserCopyright as h,isDynamicAttributionLayer as y,createAttributionIndex as c,getAttributionItemsFromIndex as g,getAttributionItemFromAccessInformation as m,getAttributionItemFromLayerCopyright as b}from"../support/attributionUtils.js";import{validateScaleRange as f}from"../support/layerViewUtils.js";let v=class extends(r(l(i))){get spatialReferenceSupported(){return!0}constructor(t){super(t),this._updatingHandles=new d,this._attributionIndexTask=null,this.layer=null,this.parent=null}initialize(){this.when().catch(t=>{if("layerview:create-error"!==t.name){const e=this.layer&&this.layer.id||"no id",i=this.layer?.title||"no title";s.getLogger(this).error("#resolve()",`Failed to resolve layer view (layer title: '${i}', id: '${e}')`,t)}})}destroy(){this._updatingHandles=n(this._updatingHandles),this._attributionIndexTask=a(this._attributionIndexTask),this._set("parent",null)}get attributionItems(){const t=this._get("attributionItems")??[];if(this.suspended||!this.layer?.attributionVisible)return 0===t.length?t:[];if(!this.view.stationary)return t;const e=this.getAttributionItems();return t?.length!==e.length||t?.some((t,i)=>t.text!==e[i].text)?e:t}get attributionUpdating(){return!!this._attributionIndexTask&&!this._attributionIndexTask.finished}get fullOpacity(){return(this.layer?.opacity??1)*(this.parent?.fullOpacity??1)}get suspended(){return this.destroyed||!this.canResume()}get suspendInfo(){return this.getSuspendInfo()}get legendEnabled(){return!this.suspended&&!0===this.layer?.legendEnabled}get updating(){return!(!this._updatingHandles?.updating&&!this.isUpdating())}get updatingProgress(){return this.updating?0:1}get updateSuspended(){return this.suspended}get visible(){return!0===this.layer?.visible}set visible(t){this._overrideIfSome("visible",t)}get visibleAtCurrentScale(){return!0}get visibleAtCurrentTimeExtent(){const t=this.view.timeExtent,e=this.layer?.visibilityTimeExtent;return!t||!e||!t.intersection(e).isEmpty}canResume(){const t=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&f(t)&&this.visibleAtCurrentScale&&this.visibleAtCurrentTimeExtent||!1}getSuspendInfo(){const t=this.parent?.suspended?this.parent.suspendInfo:{},e=this;e.view?.ready||(t.viewNotReady=!0),this.layer&&this.layer.loaded||(t.layerNotLoaded=!0);const i=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return f(i)&&this.visibleAtCurrentScale||(t.outsideScaleRange=!0),this.visibleAtCurrentTimeExtent||(t.outsideVisibilityTimeExtent=!0),this.visible||(t.layerInvisible=!0),t}isUpdating(){return!1}getAttributionItems(){const t=h(this.layer);if(t)return[t];if(y(this.layer)&&(this._attributionIndexTask||(this._attributionIndexTask=e(async t=>{const e=await this.layer.fetchAttributionData();return o(t),c(e)}),this._updatingHandles.addPromise(this._attributionIndexTask.promise)),this._attributionIndexTask?.finished&&this._attributionIndexTask.value))return g(this._attributionIndexTask.value,this.layer.tileInfo,this.view.scale,this.view.extent);const i=m(this.layer);if(i)return[i];const r=b(this.layer);return r?[r]:[]}};t([u({readOnly:!0})],v.prototype,"spatialReferenceSupported",null),t([u()],v.prototype,"view",void 0),t([u({readOnly:!0})],v.prototype,"attributionItems",null),t([u({readOnly:!0})],v.prototype,"attributionUpdating",null),t([u()],v.prototype,"fullOpacity",null),t([u()],v.prototype,"layer",void 0),t([u()],v.prototype,"parent",void 0),t([u({readOnly:!0})],v.prototype,"suspended",null),t([u({readOnly:!0})],v.prototype,"suspendInfo",null),t([u({readOnly:!0})],v.prototype,"legendEnabled",null),t([u({type:Boolean,readOnly:!0})],v.prototype,"updating",null),t([u({readOnly:!0})],v.prototype,"updatingProgress",null),t([u()],v.prototype,"updateSuspended",null),t([u()],v.prototype,"visible",null),t([u({readOnly:!0})],v.prototype,"visibleAtCurrentScale",null),t([u({readOnly:!0})],v.prototype,"visibleAtCurrentTimeExtent",null),v=t([p("esri.views.layers.LayerView")],v);export{v 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 t from"../../core/Logger.js";import{property as i,subclass as n}from"../../core/accessorSupport/decorators.js";import r from"../../geometry/SpatialReference.js";import{toExtent as o}from"../../geometry/support/aaBoundingRect.js";import{extentContainsXYZ as a}from"../../geometry/support/contains.js";import{GroundViewElevationSampler as s}from"./GroundViewElevationSampler.js";let l=class extends s{initialize(){this.view.basemapTerrain.on("elevation-change",()=>this.emit("changed",{}))}get demResolution(){return this.view.basemapTerrain.demResolution}get extent(){const e=this.view.basemapTerrain;if(null==e?.extent||null==e.spatialReference)return null;const t=o(e.extent,e.spatialReference);return t.zmin=e.
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../core/Logger.js";import{property as i,subclass as n}from"../../core/accessorSupport/decorators.js";import r from"../../geometry/SpatialReference.js";import{toExtent as o}from"../../geometry/support/aaBoundingRect.js";import{extentContainsXYZ as a}from"../../geometry/support/contains.js";import{GroundViewElevationSampler as s}from"./GroundViewElevationSampler.js";let l=class extends s{initialize(){this.view.basemapTerrain.on("elevation-change",()=>this.emit("changed",{}))}get demResolution(){return this.view.basemapTerrain.demResolution}get extent(){const e=this.view.basemapTerrain;if(null==e?.extent||null==e.spatialReference)return null;const t=o(e.extent,e.spatialReference);return t.zmin=e.visibleElevationRange.minElevation,t.zmax=e.visibleElevationRange.maxElevation,t}get spatialReference(){return this.view.basemapTerrain?.spatialReference??r.WGS84}elevationAt(e,i){if(null==this.extent||!a(this.extent,e,i)){const n=null!=this.extent?`${this.extent.xmin}, ${this.extent.ymin}, ${this.extent.xmax}, ${this.extent.ymax}`:null;return t.getLogger(this).warn("#elevationAt()",`Point used to sample elevation (${e}, ${i}) is outside of the sampler extent (${n})`),this.noDataValue}return this.view.elevationProvider?.getElevation(e,i,0,this.spatialReference,"ground")??this.noDataValue}};e([i({readOnly:!0})],l.prototype,"demResolution",null),e([i({readOnly:!0})],l.prototype,"extent",null),e([i()],l.prototype,"spatialReference",null),l=e([n("esri.views.support.GroundElevationSampler")],l);export{l as GroundElevationSampler};
|
|
@@ -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 r from"../../core/Accessor.js";import t from"../../core/Error.js";import i from"../../core/Logger.js";import{someMap as o}from"../../core/MapUtils.js";import{createResolver as s,createAbortError as a,isAbortError as n}from"../../core/promiseUtils.js";import{on as l,watch as y,syncAndInitial as h}from"../../core/reactiveUtils.js";import{schedule as
|
|
5
|
+
import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import t from"../../core/Error.js";import i from"../../core/Logger.js";import{someMap as o}from"../../core/MapUtils.js";import{createResolver as s,createAbortError as a,isAbortError as n}from"../../core/promiseUtils.js";import{on as l,watch as y,syncAndInitial as h}from"../../core/reactiveUtils.js";import{schedule as c}from"../../core/scheduling.js";import{property as p,subclass as d}from"../../core/accessorSupport/decorators.js";import{get as w}from"../../core/accessorSupport/get.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import{destroyMap as u}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as m}from"./LayerLayerViewInfo.js";function g(e){return null!=e&&"object"==typeof e&&"layerViews"in e}let _=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new f,this.supportsGround=!0,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)!1!==this.layerViewFilter?.(r)&&this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=s(),this._workPromise.promise.catch(()=>{})),this.removeHandles("reschedule"),this.addHandles(c(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const{map:e}=this.view;if(!e)return void this.clear();if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,t=[],i=this.view.ready,o=e=>{if(null!=e)for(const s of e)if(s){if(!1===this.layerViewFilter?.(s))continue;r.add(s);const e=this._layerLayerViewInfoMap.get(s);e&&i?e.start():e||this._recyclingInfoMap.has(s)||t.push(s),"layers"in s&&s.layers&&o(s.layers)}};for(const n of this._rootCollectionNames)o(w(this,n));const s=new Array,a=e=>{const r=e.tryRecycle(t);r?(this._recyclingInfoMap.set(e.layer,e),this.notifyChange("updating"),r.then(()=>{this._recyclingInfoMap.delete(e.layer),this._layerLayerViewInfoMap.set(e.layer,e),this._reschedule(),this.notifyChange("updating")}).catch(r=>{n(r)||(this._recyclingInfoMap.delete(e.layer),e.destroy(),this._reschedule(),this.notifyChange("updating"))})):s.push(e)};for(const n of this._layerLayerViewInfoMap.values())r.has(n.layer)||(this._layerLayerViewInfoMap.delete(n.layer),a(n));for(const n of this._recyclingInfoMap.values())r.has(n.layer)||(this._recyclingInfoMap.delete(n.layer),a(n));for(const n of t)this._createLayerView(n);this._refreshCollections(),s.forEach(e=>e.destroy());const l=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.groundLayers,e?.basemap?.referenceLayers,e?.layers].filter(e=>!!e);r.forEach(e=>"layers"in e&&l.push(e.layers)),this.addHandles(l.map(e=>this._watchUpdatingTracking.addOnCollectionChange(()=>e,this._reschedule)),"collection-change"),this._workPromise.resolve(),this._workPromise=null},this._layersToLayerViews=new Map(e.layerviewMapping)}initialize(){this.addHandles([l(()=>this.view?.map?.allLayers,"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),y(()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]},()=>this._reschedule(),h)]),this._preloadLayerViewModules(),this._reschedule()}clearHandles(){this._watchUpdatingTracking.removeAll()}destroy(){this.clear(),u(this._recyclingInfoMap),u(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(a()),this._workPromise=null)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||o(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(this._clearCollections(),u(this._layerLayerViewInfoMap),u(this._recyclingInfoMap))}async whenLayerView(e){await this._reschedule();const r=this._layerLayerViewInfoMap.get(e)?.promise;if(!r){const r=this._recyclingInfoMap.get(e)?.promise;if(!r)throw new t("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e});return r}return r}isCreatingLayerViewsForLayer(e,r){this.commitProperty("updatingRemaining");const t=this._layerLayerViewInfoMap.get(e);if(!t?.done)return!0;const i=t.layerView;return!(!i||!r||i.parent===r)||!!(t.done&&i&&"layers"in e&&e.layers?.length)&&e.layers.some(e=>this.isCreatingLayerViewsForLayer(e,i))}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(w(this,e),w(this,r),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining")}_clearCollections(){for(const e of this._layersToLayerViews.values())w(this,e)?.removeAll()}_populateLayerViewsOwners(e,r,t){if(!e||!r)return void r?.removeAll();let i=0;for(const o of e){const e=this._layerLayerViewInfoMap.get(o);if(!e?.layerView)continue;const{layerView:s}=e;s.layer=o,s.parent=t,r.at(i)!==s&&r.splice(i,0,s),"layers"in o&&g(s)&&this._populateLayerViewsOwners(o.layers,s.layerViews,s),++i}i<r.length&&r.splice(i)}_createLayerView(e){e.load().catch(()=>{}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const r=new m(e,this.view,this.layerViewImporter);r.promise?.then(()=>this._refreshCollections(),r=>{r&&(n(r)||"cancelled:layerview-create"===r.name)||i.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this.destroyed||this._refreshCollections()}),this._layerLayerViewInfoMap.set(e,r),this.view.ready&&r.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining")}};e([p()],_.prototype,"_workPromise",void 0),e([p({readOnly:!0})],_.prototype,"_watchUpdatingTracking",void 0),e([p({readOnly:!0})],_.prototype,"_layersToLayerViews",void 0),e([p({constructOnly:!0})],_.prototype,"layerviewMapping",void 0),e([p({readOnly:!0})],_.prototype,"_rootCollectionNames",null),e([p({constructOnly:!0})],_.prototype,"layerViewFilter",void 0),e([p()],_.prototype,"layerViewImporter",void 0),e([p()],_.prototype,"supportsGround",void 0),e([p({readOnly:!0})],_.prototype,"updating",null),e([p({readOnly:!0})],_.prototype,"updatingRemaining",null),e([p({constructOnly:!0})],_.prototype,"view",void 0),_=e([d("esri.views.support.LayerViewManager")],_);const V=_;export{V 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{equals as t}from"../../core/arrayUtils.js";import{isMultiOriginJSONMixin as o}from"../../core/multiOriginJSONSupportUtils.js";import{project as n}from"../../geometry/projectionUtils.js";import r from"../../geometry/SpatialReference.js";import{fromValues as e,containsXY as i}from"../../geometry/support/aaBoundingRect.js";import s from"./AttributionItem.js";const c=100;class a{constructor(t,o,n){this.index=t,this.bbox=o,this.score=n}}function u(t){const o=t.contributors,n={maxZoom:0,attributions:[]};if(!o)return n;for(const r of o){if(!r.coverageAreas?.length||!r.attribution)continue;const t=n.attributions.length;n.attributions.push(r.attribution);for(const o of r.coverageAreas){const r=o.bbox,i=new a(t,e(r[1],r[0],r[3],r[2]),o.score??100);for(let t=o.zoomMin;t<=o.zoomMax;t++)n[t]??=[],n[t].push(i)}}return n.maxZoom=Math.max.apply(null,Object.keys(n).map(t=>+t).filter(t=>Number.isFinite(t))),n}function l(t,o,e,c){let a=o?.scaleToZoom(e)??0;if(a=Math.min(t.maxZoom??0,Math.round(a)),!c||null==a||a<=-1)return[];const u=t[a],{x:l,y:f}=n(c.center.clone().normalize(),r.WGS84),m=new Set;return u?.filter(t=>{const o=!m.has(t.index)&&i(t.bbox,l,f);return o&&m.add(t.index),o}).map(o=>new s(t.attributions[o.index],o.score))??[]}function f(t){return p(t,"user")?new s(t.copyright,c):null}function m(t){return p(t)?new s(t.copyright,c):null}function p(t,n){return null!=t&&"object"==typeof t&&"copyright"in t&&"string"==typeof t.copyright&&t.copyright.length>0&&(!n||o(t)&&"user"===t.originOf("copyright"))}function b(t){return null!=t&&"object"==typeof t&&"hasAttributionData"in t&&!0===t.hasAttributionData&&"attributionDataUrl"in t&&"fetchAttributionData"in t&&"function"==typeof t.fetchAttributionData}function h(t){return null!=t&&"object"==typeof t&&"portalItem"in t&&null!=t.portalItem&&"object"==typeof t.portalItem&&"accessInformation"in t.portalItem&&"string"==typeof t.portalItem.accessInformation&&t.portalItem.accessInformation.length>0}function g(t){return h(t)?new s(t.portalItem.accessInformation,c):null}function y(o,n){const r=new globalThis.Map;for(const t of n){const o=r.get(t.text);o?t.score>o.score&&r.set(t.text,t):r.set(t.text,t)}const e=Array.from(r.values()).sort((t,o)=>o.score-t.score);return o&&t(o,e,(t,o)=>t.text===o.text)?o:e}export{u as createAttributionIndex,y as deduplicateAttributionItems,g as getAttributionItemFromAccessInformation,m as getAttributionItemFromLayerCopyright,f as getAttributionItemFromUserCopyright,l as getAttributionItemsFromIndex,b as isDynamicAttributionLayer};
|
|
@@ -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{createArea as e}from"../../core/quantity.js";import{geodesicAreas as r}from"../../geometry/geodesicUtils.js";import{
|
|
5
|
+
import{createArea as e}from"../../core/quantity.js";import{geodesicAreas as r}from"../../geometry/geodesicUtils.js";import{l as t,e as s}from"../../chunks/geodeticAreaOperator.js";import{isCurvedGeometry as o}from"../../geometry/support/curves/curveUtils.js";import{geodesicMeasure as a}from"./geodesicMeasurementUtils.js";const n=e=>({geodesicArea(r){const{spatialReference:t}=r,s=o(r);return a(t,s?m:u,s?m:r=>c(e,r),r)}});async function i(){const e=await import("../../geometry/geometryEngine.js");return await t(),n(e)}function u(t){return e(Math.abs(r([t],"square-meters")[0]),"square-meters")}function c(r,t){try{return e(Math.abs(r.geodesicArea(t,"square-meters")),"square-meters")}catch(s){return null}}function m(r){return e(s(r,{unit:"square-meters",curveType:"geodesic"}),"square-meters")}export{i as loadGeodesicAreaMeasurementUtils};
|
|
@@ -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{createLength as e}from"../../core/quantity.js";import{create as t}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{inverseGeodeticSolver as r,InverseGeodeticSolverResult as n,geodesicLengths as s}from"../../geometry/geodesicUtils.js";import
|
|
5
|
+
import{createLength as e}from"../../core/quantity.js";import{create as t}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{inverseGeodeticSolver as r,InverseGeodeticSolverResult as n,geodesicLengths as s}from"../../geometry/geodesicUtils.js";import o from"../../geometry/Polyline.js";import{l as i,e as c}from"../../chunks/geodeticLengthOperator.js";import{equals as m}from"../../geometry/support/spatialReferenceUtils.js";import{isCurvedGeometry as u}from"../../geometry/support/curves/curveUtils.js";import{geodesicMeasure as a}from"./geodesicMeasurementUtils.js";function f(e){const{spatialReference:t}=e,r=u(e);return a(t,r?R:h,R,e)}function p(e,t){if(!m(e.spatialReference,t.spatialReference))return null;const{spatialReference:r}=e;return U[0]=e.x,U[1]=e.y,U[2]=e.hasZ?e.z:0,v[0]=t.x,v[1]=t.y,v[2]=t.hasZ?t.z:0,l(U,v,r)}function l(e,t,r){return a(r,j,d,e,t,r)}const g={geodesicLength:f,geodesicDistanceBetweenPoints:p,geodesicDistance:l};async function y(){return await i(),g}function j(t,n,s){return e(r(x,t,n,s).distance,"meters")}function d(t,r,n){return e(c(w(t,r,n),{unit:"meters"}),"meters")}function h(t){return e(s([t],"meters")[0],"meters")}function R(t){return e(c(t,{unit:"meters"}),"meters")}function w(e,t,r){return new o({spatialReference:r,paths:[[[...e],[...t]]]})}const x=new n,U=t(),v=t();export{y as loadGeodesicLengthMeasurementUtils};
|
|
@@ -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{property as t,subclass as
|
|
5
|
+
import{__decorate as o}from"tslib";import{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import r from"../DefaultUI.js";let e=class extends r{constructor(o){super(o),this.components=["zoom"]}};o([t()],e.prototype,"components",void 0),e=o([s("esri.views.ui.2d.DefaultUI2D")],e);const p=e;export{p 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{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import
|
|
5
|
+
import{__decorate as o}from"tslib";import{property as t,subclass as s}from"../../../core/accessorSupport/decorators.js";import e from"../DefaultUI.js";let r=class extends e{constructor(o){super(o),this.components=["zoom","navigation-toggle","compass"]}};o([t()],r.prototype,"components",void 0),r=o([s("esri.views.ui.3d.DefaultUI3D")],r);const p=r;export{p 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 e from"../../core/Accessor.js";import
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../core/Accessor.js";import i from"../../core/Collection.js";import{watch as s,when as o,on as r}from"../../core/reactiveUtils.js";import{property as n,subclass as a}from"../../core/accessorSupport/decorators.js";import{getLyr3DWasm as l}from"../../views/3d/layers/Lyr3DWasm.js";function d(t,e){return t.length!==e.length||t.some((t,i)=>t.text!==e[i].text)}function h(t,e,i){if(!i||!e)return;t.find(t=>t.layerView===e&&t.text===i)||t.push({text:i,layerView:e})}const m=Symbol("attributions");let u=class extends e{constructor(t){super(t),this._clear=()=>{this.removeHandles(m)},this.items=new i,this.view=null,this._allLayerViewsChange=()=>{this.removeHandles(m);const t=this.view?.allLayerViews;let e=!1;if(t){for(const i of t)this.addHandles(s(()=>[i.attributionItems],()=>this._updateAttributionItems()),m),"type"in i&&"integrated-mesh-3dtiles"===i.type&&(e=!0,this.addHandles([s(()=>i.suspended,()=>this._updateAttributionItems()),i.on("visible-geometry-changed",()=>this._updateAttributionItems())],m));e&&this.addHandles(o(()=>!0===this.view?.stationary,()=>this._updateAttributionItems()),m)}this._updateAttributionItems()},this.addHandles([r(()=>this.view?.allLayerViews,"change",this._allLayerViewsChange,{onListenerAdd:this._allLayerViewsChange,onListenerRemove:this._clear})])}destroy(){this.view=null,this.items.removeAll()}get state(){return this.view?.ready?this.view.allLayerViews.some(t=>t.attributionUpdating)?"loading":"ready":"disabled"}_updateAttributionItems(){const t=this.view,e=t?.allLayerViews,i=[];let s=!1,o=null,r=null;if(t&&e){for(const t of e){if(t.suspended)continue;"type"in t&&"integrated-mesh-3dtiles"===t.type&&(r||=t,t.layer.hasGoogleUrl&&(s=!0,o=t));const e=t.attributionItems.slice().sort((t,e)=>e.score-t.score).map(t=>t.text).join(", ");h(i,t,e)}if(r){const e=l(t);if(e){const t=e.getAttributionText();for(let e=t.length-1;e>-1;--e)i.unshift({text:t[e],layerView:r})}}s&&o&&i.unshift({text:"Google Maps",layerView:o}),d(this.items,i)&&(this.items.removeAll(),this.items.addMany(i))}else this._clear()}};t([n({readOnly:!0,type:i})],u.prototype,"items",void 0),t([n({readOnly:!0})],u.prototype,"state",null),t([n()],u.prototype,"view",void 0),u=t([a("esri.widgets.Attribution.AttributionViewModel")],u);const c=u;export{c as default};
|
package/widgets/Attribution.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{
|
|
5
|
+
import{__decorate as e}from"tslib";import{deprecated as t}from"../core/deprecate.js";import has from"../core/has.js";import i from"../core/Logger.js";import{on as r}from"../core/reactiveUtils.js";import{property as s,subclass as o}from"../core/accessorSupport/decorators.js";import n from"./Widget.js";import l from"./Attribution/AttributionViewModel.js";import{globalCss as a}from"./support/globalCss.js";import{messageBundle as c,accessibleHandler as d,tsx as h}from"./support/widget.js";const u="esri-attribution",p={base:u,poweredBy:`${u}__powered-by`,sources:`${u}__sources`,open:`${u}--open`,sourcesOpen:`${u}__sources--open`,link:`${u}__link`};let _=class extends n{constructor(e,r){super(e,r),this._isOpen=!1,this._attributionTextOverflowed=!1,this._prevSourceNodeHeight=0,this._sourcesNode=null,this._overflowRequestAnimationFrame=null,this._resizeObserver=new ResizeObserver(e=>{e.forEach(({target:e})=>{this._scheduleOverflowCheck(e)})}),this._mutationObserver=new MutationObserver(e=>{let t=!1;for(const i of e)if("childList"===i.type||"characterData"===i.type||"attributes"===i.type){t=!0;break}t&&this._sourcesNode&&this._scheduleOverflowCheck(this._sourcesNode)}),this.itemDelimiter=" | ",this.messages=null,this.viewModel=new l,has("esri-deprecation-warnings")&&t(i.getLogger("esri.widgets.Attribution"),"This widget is deprecated. Use View.attributionVisible and View.attributionItems instead.",{replacement:"view.attributionVisible and view.attributionItems",warnOnce:!0})}initialize(){this.addHandles(r(()=>this.viewModel?.items,"change",()=>this.scheduleRender()))}destroy(){this._resizeObserver?.disconnect(),this._mutationObserver?.disconnect(),null!=this._overflowRequestAnimationFrame&&(cancelAnimationFrame(this._overflowRequestAnimationFrame),this._overflowRequestAnimationFrame=null)}get _isInteractive(){return this._isOpen||this._attributionTextOverflowed}_scheduleOverflowCheck(e){null==this._overflowRequestAnimationFrame&&(this._overflowRequestAnimationFrame=requestAnimationFrame(()=>{this._overflowRequestAnimationFrame=null,this._checkSourceTextOverflow(e)}))}get attributionText(){return this.viewModel.items.reduce((e,t)=>(e.includes(t.text)||e.push(t.text),e),[]).join(this.itemDelimiter)}get icon(){return"description"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e={[p.open]:this._isOpen};return h("div",{bind:this,class:this.classes(p.base,a.widget,e),dir:"ltr",onclick:this._toggleState,onkeydown:this._toggleState},this._renderSourcesNode(),this._renderPoweredBy())}_renderPoweredBy(){return h("div",{class:p.poweredBy},"Powered by"," ",h("a",{class:p.link,href:"https://www.esri.com/",rel:"noreferrer",target:"_blank"},"Esri"))}_renderSourcesNode(){const e=this._isOpen,t=this._isInteractive,i=t?0:void 0,{attributionText:r}=this,s={[p.sourcesOpen]:e,[a.interactive]:t};return h("div",{afterCreate:this._afterSourcesNodeCreate,bind:this,class:this.classes(p.sources,s),innerHTML:r,tabIndex:i})}_afterSourcesNodeCreate(e){this._prevSourceNodeHeight=e.clientWidth,this._sourcesNode=e,this._resizeObserver.observe(e),this._mutationObserver.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0}),this._scheduleOverflowCheck(e)}_checkSourceTextOverflow(e){let t=!1;const{clientHeight:i,clientWidth:r,scrollWidth:s}=e,o=s>r,n=this._attributionTextOverflowed!==o;if(this._attributionTextOverflowed=o,n&&(t=!0),this._isOpen){const e=i<this._prevSourceNodeHeight;this._prevSourceNodeHeight=i,e&&(this._isOpen=!1,t=!0)}t&&this.scheduleRender()}_toggleState(){this._isInteractive&&(this._isOpen=!this._isOpen)}};e([s()],_.prototype,"_isOpen",void 0),e([s()],_.prototype,"_isInteractive",null),e([s()],_.prototype,"_attributionTextOverflowed",void 0),e([s()],_.prototype,"_prevSourceNodeHeight",void 0),e([s({readOnly:!0,dependsOn:["viewModel.items.length","itemDelimiter"]})],_.prototype,"attributionText",null),e([s()],_.prototype,"icon",null),e([s()],_.prototype,"itemDelimiter",void 0),e([s()],_.prototype,"label",null),e([s(),c("esri/widgets/Attribution/t9n/Attribution")],_.prototype,"messages",void 0),e([s()],_.prototype,"view",null),e([s({type:l})],_.prototype,"viewModel",void 0),e([d()],_.prototype,"_toggleState",null),_=e([o("esri.widgets.Attribution")],_);const v=_;export{v 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
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../Color.js";import{deprecated as o,esriurl as i}from"../../core/deprecate.js";import{EventedAccessor as r}from"../../core/Evented.js";import{handlesGroup as s}from"../../core/handleUtils.js";import has from"../../core/has.js";import l from"../../core/Logger.js";import{memoize as n}from"../../core/memoize.js";import{watch as p,syncAndInitial as a,sync as u}from"../../core/reactiveUtils.js";import{generateUUID as m}from"../../core/uuid.js";import{property as c,subclass as h}from"../../core/accessorSupport/decorators.js";import d from"../../geometry/Point.js";import{getConfig as f}from"./support/constants.js";import{binaryFindClosest as v}from"./support/profileUtils.js";import{convertSamples as y,convertStatistics as g}from"./support/unitUtils.js";let b=class extends r{constructor(e){super(e),this.type=null,this.id=m(),this.title=null,this.color=new t("#000000"),this.visible=!0,this._getSamplesMemoized=n((e,t)=>y(e,t)),this._getStatisticsMemoized=n((e,t)=>g(e,t)),this.viewVisualizationEnabled=!0,this.result=null,this.effectiveUnits=null,this.numSamplesForPreview=30,this.numSamplesPerChunk=200,this.chartFillEnabled=!0,this.chartStrokeWidth=1.5,this.chartStrokeOffsetY=0,this._viewModel=null,has("esri-deprecation-warnings")&&!e?.isDefaultLine&&o(l.getLogger(this),"This class is deprecated. Use the Elevation Profile component or the elevation profile analysis directly instead.",{see:[`Elevation Profile component reference: ${i}arcgis-elevation-profile/`,`Esri's move to web components: ${i}components-transition-plan/`],replacement:"ElevationProfileAnalysis or <arcgis-elevation-profile></arcgis-elevation-profile>",warnOnce:!0})}normalizeCtorArgs(e){const{isDefaultLine:t,...o}=e??{};return o}get progress(){return null!=this.result&&this.visible?this.result.progress:0}get samples(){return this._getSamplesMemoized(this.result,this.effectiveUnits)}get statistics(){return this._getStatisticsMemoized(this.result,this.effectiveUnits)}get hoveredPoint(){const e=this._viewModel?.hoveredChartPosition;return null!=e?this._getPoint(e):null}get available(){return!0}get hasZ(){const e=this.result;return null!=e&&e.hasZ}get minDemResolution(){return f().defaultDemResolution}queryElevation(){throw new Error("not implemented")}attach(e){return this._viewModel=e,s([p(()=>e.effectiveUnits,e=>{this.effectiveUnits=e},a),p(()=>[e.input],()=>this._onChange(),u)])}toggleVisibility(e){this.visible=void 0===e?!this.visible:e}_onChange(){this.emit("change")}_getPoint(e){const{samples:t,result:o}=this;if(null==t||null==o)return null;const i=t.length;if(0===i)return null;const r=t[i-1].distance,s=v(t,e*r,e=>e.distance);if(null==s)return null;const{x:l,y:n,z:p}=s;return null==p?null:new d({x:l,y:n,z:p,spatialReference:o.spatialReference})}};e([c({nonNullable:!0})],b.prototype,"id",void 0),e([c()],b.prototype,"title",void 0),e([c({type:t,nonNullable:!0})],b.prototype,"color",void 0),e([c({nonNullable:!0})],b.prototype,"visible",void 0),e([c({readOnly:!0})],b.prototype,"progress",null),e([c({readOnly:!0})],b.prototype,"samples",null),e([c({readOnly:!0})],b.prototype,"statistics",null),e([c()],b.prototype,"hoveredPoint",null),e([c()],b.prototype,"viewVisualizationEnabled",void 0),e([c()],b.prototype,"available",null),e([c()],b.prototype,"result",void 0),e([c()],b.prototype,"effectiveUnits",void 0),e([c()],b.prototype,"numSamplesForPreview",void 0),e([c()],b.prototype,"numSamplesPerChunk",void 0),e([c()],b.prototype,"chartFillEnabled",void 0),e([c()],b.prototype,"chartStrokeWidth",void 0),e([c()],b.prototype,"chartStrokeOffsetY",void 0),e([c({readOnly:!0})],b.prototype,"hasZ",null),e([c({readOnly:!0})],b.prototype,"minDemResolution",null),e([c()],b.prototype,"_viewModel",void 0),b=e([h("esri.widgets.ElevationProfile.ElevationProfileLine")],b);const w=b;export{w 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 e from"../../Graphic.js";import i from"../../core/Accessor.js";import{isSome as r,min as o}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import{referenceSetter as l}from"../../core/collectionUtils.js";import n from"../../core/Logger.js";import{LRUCache as
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../Graphic.js";import i from"../../core/Accessor.js";import{isSome as r,min as o}from"../../core/arrayUtils.js";import s from"../../core/Collection.js";import{referenceSetter as l}from"../../core/collectionUtils.js";import{deprecateUnnecessaryViewModel as n}from"../../core/deprecate.js";import u from"../../core/Logger.js";import{LRUCache as a}from"../../core/LRUCache.js";import{destroyMaybe as p}from"../../core/maybe.js";import{memoize as h}from"../../core/memoize.js";import{watch as c,syncAndInitial as d}from"../../core/reactiveUtils.js";import{adaptiveLengthUnit as f,adaptiveVerticalLengthUnit as m,measurementLengthUnits as v}from"../../core/units.js";import{property as g,subclass as y}from"../../core/accessorSupport/decorators.js";import{ElevationQueryTileCache as b}from"../../layers/support/ElevationQueryTileCache.js";import{defaultUnitPropertyMetadata as _}from"../../properties/defaultUnit.js";import{ElevationProfileController as U}from"./ElevationProfileController.js";import P from"./ElevationProfileLineGround.js";import{ElevationProfileLineCollection as w}from"./elevationProfileLineTypes.js";import{ElevationProfileTool as j}from"./ElevationProfileTool.js";import{isPolyline as O,isValidInputPath as C}from"./support/geometryUtils.js";import{isProfileGenerationError as E}from"./support/ProfileGenerationError.js";import{createProfileQueue as S}from"./support/profileUtils.js";import{getBoundsInMeters as T,mergeStatistics as D}from"./support/statisticsUtils.js";let L=class extends i{constructor(t){super(t),this.view=null,this.input=null,this._getEffectiveUnitsMemoized=h((t,e)=>({distance:t,elevation:e})),this.hoveredChartPosition=null,this.uniformChartScaling=!1,this.defaultUnit=null,this.queue=null,this._currentTileCache=null,this.error=null,this._defaultProfileLineGround=new P({isDefaultLine:!0}),this._userUnitOptions=null,this._userUnit=null,t?.isDefaultViewModel||n(u.getLogger(this),"Elevation Profile","arcgis-elevation-profile",{version:"5.0"}),t?.profiles||(this.profiles=new s([this._defaultProfileLineGround]))}normalizeCtorArgs(t){const{isDefaultViewModel:e,...i}=t??{};return i}initialize(){this.addHandles(c(()=>this.view,t=>{if(null==t)return void u.getLogger(this).warnOnce("no view. Widget will be disabled until a view is provided.");this.removeHandles(G);const e="3d"===t.type?t.resourceController:void 0;this.queue?.destroy(),this.queue=S(e?.scheduler);const i=e?.addUpdatingObject(this);i&&this.addHandles(i,G)},d)),this.tool=new j({viewModel:this}),this._controller=new U({viewModel:this})}destroy(){this._defaultProfileLineGround=p(this._defaultProfileLineGround),this._controller=p(this._controller),this._currentTileCache=p(this._currentTileCache),this.tool=p(this.tool),this.queue=p(this.queue)}get profiles(){return this._get("profiles")}set profiles(t){const e=this._get("profiles"),i=t??new s;this._set("profiles",l(i,e))}get state(){const t=this.view;return null!=t&&t.ready?this.tool.state:"disabled"}get progress(){let t=0,e=0;for(const i of this.visibleProfiles)t++,e+=i.progress;return t>0?e/t:0}set unitOptions(t){this._userUnitOptions=t,this._set("unitOptions",this._filteredOrAllUnits(this._userUnitOptions))}get unitOptions(){return this._filteredOrAllUnits(this._userUnitOptions)}set unit(t){this._userUnit=t?this._findSelectableUnit(t,this._userUnit):null,this.notifyChange("unit")}get unit(){return this._userUnit?(this._userUnit=this._findSelectableUnit(this._userUnit,this.defaultUnit),this._userUnit):this._findSelectableUnit(this.defaultUnit)}get effectiveUnits(){const t=T(this.visibleProfiles.map(t=>t.result)),e=f(t.maxDistance,"meters",this.unit),i=m(t.maxElevation,"meters",this.unit);return this._getEffectiveUnitsMemoized(e,i)}get highlightEnabled(){return this.tool.highlightEnabled}set highlightEnabled(t){this.tool.highlightEnabled=t}get hasVertices(){const t=this.input?.geometry;return O(t)&&t.paths.reduce((t,e)=>t+e.length,0)>0}get hoveredPoints(){return null!=this.input&&this.visible&&this.tool.editable?this.visibleProfiles.map(t=>{const e=t.hoveredPoint;return null!=e?{hoveredPoint:e,color:t.color}:null}).filter(r):[]}get statistics(){return D(this.visibleProfiles.map(t=>t.statistics))}get chartData(){if(null==this.input)return null;const{effectiveUnits:t,progress:e,statistics:i,visibleProfiles:r,uniformChartScaling:o}=this,s=r.filter(t=>t.hasZ).map(t=>({id:t.id,type:t.type,title:t.title,color:t.color,samples:t.samples,progress:t.progress,chartFillEnabled:t.chartFillEnabled,chartStrokeWidth:t.chartStrokeWidth,chartStrokeOffsetY:t.chartStrokeOffsetY,viewVisualizationEnabled:t.viewVisualizationEnabled}));return 0===s.length?null:{lines:s,effectiveUnits:t,statistics:i,refined:1===e,dynamicElevationRange:r.some(t=>"view"===t.type),uniformScaling:o}}get visibleProfiles(){return this.profiles.toArray().filter(t=>t.available&&t.visible)}get minDemResolutions(){const t=[];for(const{minDemResolution:e}of this.visibleProfiles)null!=e&&t.push(e);return t}get minDemResolution(){return o(this.minDemResolutions)}get errorState(){const t=this.input?.geometry;if(!C(t))return"no-valid-input";if(null!=this.error){if(E(this.error))switch(this.error.cause){case"too-complex":return"too-complex";case"invalid-geometry":return"invalid-geometry";case"invalid-elevation-info":return"invalid-elevation-info";case"elevation-query-error":return"no-valid-input"}return"unknown-error"}return 0===this.visibleProfiles.length?"no-visible-profiles":null==this.chartData&&1===this.progress?"refined-but-no-chart-data":"none"}get tileCache(){this._currentTileCache=p(this._currentTileCache);const t=this.view;if(null!=t&&"3d"===t?.type){const e=t.basemapTerrain?.elevationQueryCache;if(null!=e)return e}return null==this._currentTileCache&&(this._currentTileCache=new b(new a(20971520))),this._currentTileCache}get visible(){return this.tool.visible}set visible(t){this.tool.visible=t}get selectAvailable(){for(const t of this.view?.map?.allLayers??[]){if("graphics"===t.type&&!t.internal&&t.graphics.some(t=>"polyline"===t.geometry?.type))return!0;if("geometryType"in t&&"polyline"===t.geometryType)return!0}return!!this.view?.graphics?.some(t=>"polyline"===t.geometry?.type)}get inputIsSketched(){return this.tool.interaction.isSketchedGraphic(this.input)}get elevationProvider(){const t=this.view;return null!=t&&"3d"===t.type?t.elevationProvider:null}get updating(){const{progress:t}=this,e=!!this.queue?.updating;return t>0&&t<1||e}start(t){this.tool.interaction.start(t)}stop(){this.tool.interaction.stop()}cancel(){this.tool.interaction.cancel()}clear(){this.tool.interaction.clear()}_findSelectableUnit(t,e){const i=this.unitOptions;return null!=t&&i.includes(t)?t:e?this._findSelectableUnit(e):i[0]}_filteredOrAllUnits(t){const e=(null!=t?t:[]).filter(t=>v.includes(t));return 0===e.length?v.slice():e}};t([g()],L.prototype,"view",void 0),t([g({type:e})],L.prototype,"input",void 0),t([g({type:w,nonNullable:!0})],L.prototype,"profiles",null),t([g({readOnly:!0})],L.prototype,"state",null),t([g({readOnly:!0})],L.prototype,"progress",null),t([g()],L.prototype,"unitOptions",null),t([g()],L.prototype,"unit",null),t([g({readOnly:!0})],L.prototype,"effectiveUnits",null),t([g()],L.prototype,"hoveredChartPosition",void 0),t([g()],L.prototype,"uniformChartScaling",void 0),t([g()],L.prototype,"highlightEnabled",null),t([g({readOnly:!0})],L.prototype,"hoveredPoints",null),t([g({readOnly:!0})],L.prototype,"statistics",null),t([g()],L.prototype,"chartData",null),t([g()],L.prototype,"visibleProfiles",null),t([g()],L.prototype,"minDemResolutions",null),t([g({readOnly:!0})],L.prototype,"minDemResolution",null),t([g({readOnly:!0})],L.prototype,"errorState",null),t([g(_)],L.prototype,"defaultUnit",void 0),t([g()],L.prototype,"queue",void 0),t([g()],L.prototype,"tileCache",null),t([g()],L.prototype,"tool",void 0),t([g()],L.prototype,"visible",null),t([g()],L.prototype,"error",void 0),t([g()],L.prototype,"selectAvailable",null),t([g()],L.prototype,"inputIsSketched",null),t([g()],L.prototype,"elevationProvider",null),t([g()],L.prototype,"updating",null),t([g()],L.prototype,"_defaultProfileLineGround",void 0),t([g()],L.prototype,"_userUnitOptions",void 0),t([g()],L.prototype,"_controller",void 0),t([g()],L.prototype,"_userUnit",void 0),L=t([y("esri.widgets.ElevationProfile.ElevationProfileViewModel")],L);const G=Symbol("updating-object"),k=L;export{k 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{createTask as e}from"../core/asyncUtils.js";import{abortMaybe as i,destroyMaybe as s}from"../core/maybe.js";import{memoize as n}from"../core/memoize.js";import{throwIfAborted as r,createAbortError as o}from"../core/promiseUtils.js";import{watch as a,initial as l}from"../core/reactiveUtils.js";import{property as c,subclass as h}from"../core/accessorSupport/decorators.js";import d from"./Widget.js";import{css as p}from"./ElevationProfile/css.js";import u from"./ElevationProfile/ElevationProfileViewModel.js";import m from"./ElevationProfile/ElevationProfileVisibleElements.js";import{Legend as _}from"./ElevationProfile/components/Legend.js";import{SettingsButton as v}from"./ElevationProfile/components/SettingsButton.js";import{getConfig as C}from"./ElevationProfile/support/constants.js";import{loadCalciteComponents as g}from"./support/componentsUtils.js";import{globalCss as f}from"./support/globalCss.js";import{messageBundle as y,tsx as b,tsxFragment as w}from"./support/widget.js";const k=[{type:"select"},{type:"sketch"}],M={none:null,"no-valid-input":"noProfile","no-visible-profiles":"noProfile","refined-but-no-chart-data":"noProfile","too-complex":"tooComplex","unknown-error":"unknown","invalid-geometry":"invalidGeometry","invalid-elevation-info":"invalidElevationInfo"};let B=class extends d{constructor(t,e){super(t,e),this.viewModel=null,this.visibleElements=new m,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this._chartContainer=null,this._chart=null,this._chartInitTask=null,this._chartIsRefined=!1,this._zoomOutButtonVisible=!1,this._getChartUpdateParamsMemoized=n((t,e,i,s)=>({chart:t,data:e,stationary:i,messages:s})),this._onZoomOutButtonClick=()=>{this._chart?.zoomOut()},this._onClearButtonClick=()=>{this.viewModel.clear()},t?.viewModel||(this._defaultViewModel=new u({view:t?.view}),this.viewModel=this._defaultViewModel)}loadDependencies(){return g({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}postInitialize(){this.addHandles([a(()=>({container:this._chartContainer}),({container:t})=>{this._destroyChart(),null!=t&&this._initializeChart(t)},l),a(()=>this._chartUpdateParams,()=>this._updateChart(this._chartUpdateParams),l)])}destroy(){this._destroyChart(),null!=this._defaultViewModel&&this.viewModel!==this._defaultViewModel&&this._defaultViewModel.destroy()}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}get input(){return this.viewModel.input}set input(t){this.viewModel.input=t}get profiles(){return this.viewModel.profiles}set profiles(t){this.viewModel.profiles=t}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(t){this.viewModel.unitOptions=t}get unit(){return this.viewModel.unit}set unit(t){this.viewModel.unit=t}get icon(){return"altitude"}set icon(t){this._overrideIfSome("icon",t)}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}get visible(){return this.viewModel.visible}set visible(t){this.viewModel.visible=t}get test(){return{chart:this._chart}}get _selectButtonVisible(){return!0===this.visibleElements.selectButton&&this.viewModel.selectAvailable}get _chartUpdateParams(){const t=this.view;return this._getChartUpdateParamsMemoized(this._chart,this.viewModel.chartData,null==t||t.stationary,this._chartMessages)}get _chartMessages(){return{...this.messagesUnits,...this.messages}}get _profilesArray(){return this.profiles.toArray()}render(){const{viewModel:t,visible:e}=this;return b("div",{"aria-label":this.messages.widgetLabel,class:this.classes({[p.base]:e,[f.widget]:e,[f.panel]:e,[f.widgetDisabled]:e&&"disabled"===t.state,[p.refined]:1===t.progress}),key:this},b("div",{bind:this,key:"content-wrapper"},e?this._renderContentForState():null))}_renderContentForState(){switch(this.viewModel.state){case"ready":case"disabled":return this._renderContentForReadyState();case"selecting":return this._renderContentForSelectingState();case"creating":return this._renderContentForCreatingState();case"selected":return this._renderContentForSelectedState();case"created":return this._renderContentForCreatedState()}}_renderContentForReadyState(){const{messages:t,visibleElements:e,_selectButtonVisible:i}=this,{sketchButton:s}=e;let n;return n=s&&i?t.readyPrompt:s?t.readyPromptCreateOnly:i?t.readyPromptSelectOnly:t.errors?.noProfile,this._renderContent({prompt:n,chart:!1,actions:k})}_renderContentForSelectingState(){const{view:t}=this;if(null==t)return null;const e=this.messages[`selectingPrompt-${t.type}`];return this._renderContent({prompt:e,chart:!1,actions:[{type:"select-cancel"}]})}_renderContentForCreatingState(){const{view:t,viewModel:e}=this;if(null==t)return null;const i=e.hasVertices?[{type:"sketch-cancel"},{type:"sketch-done",disabled:!e.tool.interaction.canStopCreating}]:[{type:"select"},{type:"sketch",disabled:!0}];if("no-valid-input"===e.errorState){const e=this.messages[`creatingPrompt-${t.type}`];return this._renderContent({chart:!1,actions:i,prompt:e})}const s=this._getErrorMessage();return s?this._renderContent({chart:!1,actions:i,prompt:s}):this._renderContent({chart:!0,actions:i})}_renderContentForSelectedState(){const t=this._getErrorMessage();return t?this._renderContent({chart:!1,actions:k,prompt:t}):this._renderContent({chart:!0,actions:k})}_renderContentForCreatedState(){const t=this._getErrorMessage();return t?this._renderContent({chart:!1,actions:k,prompt:t}):this._renderContent({chart:!0,actions:k})}_getErrorMessage(){const t=M[this.viewModel.errorState];return t?this.messages?.errors?.[t]:null}_renderContent(t){const e=null!=t.prompt?this._renderPrompt(t.prompt):t.chart&&this._renderChart(),{viewModel:i}=this,s=null!=i.input;return b(w,null,b("header",{class:p.header,key:"header"},this._zoomOutButtonVisible?this._renderZoomOutButton():null,this.visibleElements.clearButton&&s?this._renderClearButton():null,this.visibleElements.settingsButton?b(v,{messages:this.messages,uniformChartScaling:i.uniformChartScaling,unit:i.unit,unitOptions:i.unitOptions,visibleElements:this.visibleElements,onUniformChartScalingChange:t=>i.uniformChartScaling=t,onUnitChange:t=>i.unit=t}):null),b("div",{class:p.mainContainer,key:"main-container"},e),this.visibleElements.legend?b(_,{effectiveUnits:i.effectiveUnits,messages:this.messages,profiles:this._profilesArray}):null,this._renderActions(t))}_renderZoomOutButton(){const t=this.messages.zoomOut;return b("calcite-action",{appearance:"transparent",class:p.zoomOutButton,"data-testid":"zoom-out-button",icon:"magnifying-glass-minus",key:"zoom-out",onclick:this._onZoomOutButtonClick,scale:"s",text:t,title:t})}_renderClearButton(){const t=this.messages.clearProfile;return b("calcite-action",{appearance:"transparent",class:p.clearButton,"data-testid":"clear-button",icon:"trash",key:"clear-profile",onclick:this._onClearButtonClick,scale:"s",text:t,title:t})}_renderPrompt(t){return[b("div",{bind:this,class:p.promptContainer,key:"prompt-container"},b("p",null,t))]}_renderChart(){if(!this.visibleElements.chart)return b("div",{class:p.chartContainer,key:"empty-chart-container"});const{chartData:t,progress:e}=this.viewModel,i=this._chartIsRefined||this._canRenderChart(),s=null!=t&&e<1;return i?b(w,null,this._renderSpinner({size:i?"small":"large",visible:s}),b("div",{afterCreate:this._onChartContainerUpdate,afterRemoved:this._onChartContainerRemoved,afterUpdate:this._onChartContainerUpdate,bind:this,class:p.chartContainer,key:"chart-container"})):b(w,null,this._renderSpinner({size:"large",visible:s}),b("div",{class:p.chartContainer,key:"chart-container-empty"}))}_renderSpinner(t){const e="small"===t.size,i=t.visible??!0;return b("calcite-loader",{class:this.classes(p.chartSpinner,e&&p.chartSpinnerSmall,i&&p.chartSpinnerVisible),"data-testid":"chart-spinner",inline:e,key:"spinner",label:"",scale:"s"})}_canRenderChart(){const t=this.viewModel.chartData;if(null==t)return!1;if(!this.viewModel.inputIsSketched)return t.refined;let e=0;for(const{samples:i}of t.lines)e+=null!=i?i.length:0;return t.refined||e<=C().largeChartSamples}_renderActions({actions:t}){const e=t.map(t=>{switch(t.type){case"sketch":return this.visibleElements.sketchButton&&this._renderAction({action:t,className:p.sketchButton,label:this.messages.sketchButtonLabel,onClick:this._onSketchButtonClick,primary:!0});case"sketch-cancel":return this.visibleElements.sketchButton&&this._renderAction({action:t,onClick:this._onCancelButtonClick,className:p.sketchCancelButton,label:this.messagesCommon.cancel,primary:!1});case"sketch-done":return this.visibleElements.sketchButton&&this._renderAction({action:t,onClick:this._onDoneButtonClick,className:p.sketchDoneButton,label:this.messagesCommon.done,primary:!0});case"select":return this._selectButtonVisible&&this._renderAction({action:t,onClick:this._onSelectButtonClick,className:p.selectButton,label:this.messages.selectButtonLabel,primary:!1});case"select-cancel":return this._selectButtonVisible&&this._renderAction({action:t,onClick:this._onCancelButtonClick,className:p.selectCancelButton,label:this.messagesCommon.cancel,primary:!1})}}).filter(Boolean);return e.length?b("footer",{class:p.footer,key:"footer"},e):null}_renderAction({action:t,className:e,label:i,onClick:s,primary:n}){return b("calcite-button",{appearance:n?"solid":"outline-fill",bind:this,class:this.classes(p.actionButton,e),disabled:t.disabled,key:`action-${t.type}`,onclick:s},i)}_onSketchButtonClick(){this.viewModel.start({mode:"sketch"})}_onSelectButtonClick(){this.viewModel.start({mode:"select"})}_onCancelButtonClick(){this.viewModel.cancel()}_onDoneButtonClick(){this.viewModel.stop()}_updateChart(t){const{data:e,chart:i,messages:s,stationary:n}=t;null!=i&&null!=s&&n&&this._canRenderChart()&&(i.update(t),this._chartIsRefined=null!=e&&e.refined)}_onChartContainerUpdate(t){this._chartContainer=t}_onChartContainerRemoved(t){this._chartContainer===t&&(this._chartContainer=null)}_initializeChart(t){i(this._chartInitTask),this._chartInitTask=e(async e=>{const{createChart:i}=await import("./ElevationProfile/support/chartUtils.js");r(e);const n=await i({container:t,abortOptions:{signal:e},onRangeChange:(t,e)=>{this._zoomOutButtonVisible=1!==t||1!==e},onCursorPositionChange:t=>{this.viewModel.hoveredChartPosition=t}});if(e.aborted)throw s(n),o();this._chart=n,this._updateChart(this._chartUpdateParams)})}_destroyChart(){this._chartInitTask=i(this._chartInitTask),this._chart=s(this._chart),this._chartIsRefined=!1}};t([c({type:u})],B.prototype,"viewModel",void 0),t([c()],B.prototype,"view",null),t([c()],B.prototype,"input",null),t([c()],B.prototype,"profiles",null),t([c()],B.prototype,"unitOptions",null),t([c()],B.prototype,"unit",null),t([c({type:m,nonNullable:!0})],B.prototype,"visibleElements",void 0),t([c()],B.prototype,"icon",null),t([c()],B.prototype,"label",null),t([c()],B.prototype,"visible",null),t([c(),y("esri/widgets/ElevationProfile/t9n/ElevationProfile")],B.prototype,"messages",void 0),t([c(),y("esri/t9n/common")],B.prototype,"messagesCommon",void 0),t([c(),y("esri/core/t9n/Units")],B.prototype,"messagesUnits",void 0),t([c()],B.prototype,"_chartContainer",void 0),t([c()],B.prototype,"_chart",void 0),t([c()],B.prototype,"_chartInitTask",void 0),t([c()],B.prototype,"_chartIsRefined",void 0),t([c()],B.prototype,"_zoomOutButtonVisible",void 0),t([c()],B.prototype,"_selectButtonVisible",null),t([c()],B.prototype,"_chartUpdateParams",null),t([c()],B.prototype,"_chartMessages",null),t([c()],B.prototype,"_profilesArray",null),B=t([h("esri.widgets.ElevationProfile")],B);const S=B;export{S as default};
|
|
5
|
+
import{__decorate as t}from"tslib";import{createTask as e}from"../core/asyncUtils.js";import{deprecateWidget as i}from"../core/deprecate.js";import s from"../core/Logger.js";import{abortMaybe as n,destroyMaybe as r}from"../core/maybe.js";import{memoize as o}from"../core/memoize.js";import{throwIfAborted as a,createAbortError as l}from"../core/promiseUtils.js";import{watch as c,initial as h}from"../core/reactiveUtils.js";import{property as d,subclass as p}from"../core/accessorSupport/decorators.js";import u from"./Widget.js";import{css as m}from"./ElevationProfile/css.js";import _ from"./ElevationProfile/ElevationProfileViewModel.js";import v from"./ElevationProfile/ElevationProfileVisibleElements.js";import{Legend as C}from"./ElevationProfile/components/Legend.js";import{SettingsButton as g}from"./ElevationProfile/components/SettingsButton.js";import{getConfig as f}from"./ElevationProfile/support/constants.js";import{loadCalciteComponents as y}from"./support/componentsUtils.js";import{globalCss as b}from"./support/globalCss.js";import{messageBundle as w,tsx as k,tsxFragment as M}from"./support/widget.js";const B=[{type:"select"},{type:"sketch"}],S={none:null,"no-valid-input":"noProfile","no-visible-profiles":"noProfile","refined-but-no-chart-data":"noProfile","too-complex":"tooComplex","unknown-error":"unknown","invalid-geometry":"invalidGeometry","invalid-elevation-info":"invalidElevationInfo"};let P=class extends u{constructor(t,e){super(t,e),this.viewModel=null,this.visibleElements=new v,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this._chartContainer=null,this._chart=null,this._chartInitTask=null,this._chartIsRefined=!1,this._zoomOutButtonVisible=!1,this._getChartUpdateParamsMemoized=o((t,e,i,s)=>({chart:t,data:e,stationary:i,messages:s})),this._onZoomOutButtonClick=()=>{this._chart?.zoomOut()},this._onClearButtonClick=()=>{this.viewModel.clear()},i(s.getLogger(this),"Elevation Profile","arcgis-elevation-profile",{version:"5.0"}),t?.viewModel||(this._defaultViewModel=new _({view:t?.view,isDefaultViewModel:!0}),this.viewModel=this._defaultViewModel)}loadDependencies(){return y({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}postInitialize(){this.addHandles([c(()=>({container:this._chartContainer}),({container:t})=>{this._destroyChart(),null!=t&&this._initializeChart(t)},h),c(()=>this._chartUpdateParams,()=>this._updateChart(this._chartUpdateParams),h)])}destroy(){this._destroyChart(),null!=this._defaultViewModel&&this.viewModel!==this._defaultViewModel&&this._defaultViewModel.destroy()}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}get input(){return this.viewModel.input}set input(t){this.viewModel.input=t}get profiles(){return this.viewModel.profiles}set profiles(t){this.viewModel.profiles=t}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(t){this.viewModel.unitOptions=t}get unit(){return this.viewModel.unit}set unit(t){this.viewModel.unit=t}get icon(){return"altitude"}set icon(t){this._overrideIfSome("icon",t)}get label(){return this.messages?.widgetLabel??""}set label(t){this._overrideIfSome("label",t)}get visible(){return this.viewModel.visible}set visible(t){this.viewModel.visible=t}get test(){return{chart:this._chart}}get _selectButtonVisible(){return!0===this.visibleElements.selectButton&&this.viewModel.selectAvailable}get _chartUpdateParams(){const t=this.view;return this._getChartUpdateParamsMemoized(this._chart,this.viewModel.chartData,null==t||t.stationary,this._chartMessages)}get _chartMessages(){return{...this.messagesUnits,...this.messages}}get _profilesArray(){return this.profiles.toArray()}render(){const{viewModel:t,visible:e}=this;return k("div",{"aria-label":this.messages.widgetLabel,class:this.classes({[m.base]:e,[b.widget]:e,[b.panel]:e,[b.widgetDisabled]:e&&"disabled"===t.state,[m.refined]:1===t.progress}),key:this},k("div",{bind:this,key:"content-wrapper"},e?this._renderContentForState():null))}_renderContentForState(){switch(this.viewModel.state){case"ready":case"disabled":return this._renderContentForReadyState();case"selecting":return this._renderContentForSelectingState();case"creating":return this._renderContentForCreatingState();case"selected":return this._renderContentForSelectedState();case"created":return this._renderContentForCreatedState()}}_renderContentForReadyState(){const{messages:t,visibleElements:e,_selectButtonVisible:i}=this,{sketchButton:s}=e;let n;return n=s&&i?t.readyPrompt:s?t.readyPromptCreateOnly:i?t.readyPromptSelectOnly:t.errors?.noProfile,this._renderContent({prompt:n,chart:!1,actions:B})}_renderContentForSelectingState(){const{view:t}=this;if(null==t)return null;const e=this.messages[`selectingPrompt-${t.type}`];return this._renderContent({prompt:e,chart:!1,actions:[{type:"select-cancel"}]})}_renderContentForCreatingState(){const{view:t,viewModel:e}=this;if(null==t)return null;const i=e.hasVertices?[{type:"sketch-cancel"},{type:"sketch-done",disabled:!e.tool.interaction.canStopCreating}]:[{type:"select"},{type:"sketch",disabled:!0}];if("no-valid-input"===e.errorState){const e=this.messages[`creatingPrompt-${t.type}`];return this._renderContent({chart:!1,actions:i,prompt:e})}const s=this._getErrorMessage();return s?this._renderContent({chart:!1,actions:i,prompt:s}):this._renderContent({chart:!0,actions:i})}_renderContentForSelectedState(){const t=this._getErrorMessage();return t?this._renderContent({chart:!1,actions:B,prompt:t}):this._renderContent({chart:!0,actions:B})}_renderContentForCreatedState(){const t=this._getErrorMessage();return t?this._renderContent({chart:!1,actions:B,prompt:t}):this._renderContent({chart:!0,actions:B})}_getErrorMessage(){const t=S[this.viewModel.errorState];return t?this.messages?.errors?.[t]:null}_renderContent(t){const e=null!=t.prompt?this._renderPrompt(t.prompt):t.chart&&this._renderChart(),{viewModel:i}=this,s=null!=i.input;return k(M,null,k("header",{class:m.header,key:"header"},this._zoomOutButtonVisible?this._renderZoomOutButton():null,this.visibleElements.clearButton&&s?this._renderClearButton():null,this.visibleElements.settingsButton?k(g,{messages:this.messages,uniformChartScaling:i.uniformChartScaling,unit:i.unit,unitOptions:i.unitOptions,visibleElements:this.visibleElements,onUniformChartScalingChange:t=>i.uniformChartScaling=t,onUnitChange:t=>i.unit=t}):null),k("div",{class:m.mainContainer,key:"main-container"},e),this.visibleElements.legend?k(C,{effectiveUnits:i.effectiveUnits,messages:this.messages,profiles:this._profilesArray}):null,this._renderActions(t))}_renderZoomOutButton(){const t=this.messages.zoomOut;return k("calcite-action",{appearance:"transparent",class:m.zoomOutButton,"data-testid":"zoom-out-button",icon:"magnifying-glass-minus",key:"zoom-out",onclick:this._onZoomOutButtonClick,scale:"s",text:t,title:t})}_renderClearButton(){const t=this.messages.clearProfile;return k("calcite-action",{appearance:"transparent",class:m.clearButton,"data-testid":"clear-button",icon:"trash",key:"clear-profile",onclick:this._onClearButtonClick,scale:"s",text:t,title:t})}_renderPrompt(t){return[k("div",{bind:this,class:m.promptContainer,key:"prompt-container"},k("p",null,t))]}_renderChart(){if(!this.visibleElements.chart)return k("div",{class:m.chartContainer,key:"empty-chart-container"});const{chartData:t,progress:e}=this.viewModel,i=this._chartIsRefined||this._canRenderChart(),s=null!=t&&e<1;return i?k(M,null,this._renderSpinner({size:i?"small":"large",visible:s}),k("div",{afterCreate:this._onChartContainerUpdate,afterRemoved:this._onChartContainerRemoved,afterUpdate:this._onChartContainerUpdate,bind:this,class:m.chartContainer,key:"chart-container"})):k(M,null,this._renderSpinner({size:"large",visible:s}),k("div",{class:m.chartContainer,key:"chart-container-empty"}))}_renderSpinner(t){const e="small"===t.size,i=t.visible??!0;return k("calcite-loader",{class:this.classes(m.chartSpinner,e&&m.chartSpinnerSmall,i&&m.chartSpinnerVisible),"data-testid":"chart-spinner",inline:e,key:"spinner",label:"",scale:"s"})}_canRenderChart(){const t=this.viewModel.chartData;if(null==t)return!1;if(!this.viewModel.inputIsSketched)return t.refined;let e=0;for(const{samples:i}of t.lines)e+=null!=i?i.length:0;return t.refined||e<=f().largeChartSamples}_renderActions({actions:t}){const e=t.map(t=>{switch(t.type){case"sketch":return this.visibleElements.sketchButton&&this._renderAction({action:t,className:m.sketchButton,label:this.messages.sketchButtonLabel,onClick:this._onSketchButtonClick,primary:!0});case"sketch-cancel":return this.visibleElements.sketchButton&&this._renderAction({action:t,onClick:this._onCancelButtonClick,className:m.sketchCancelButton,label:this.messagesCommon.cancel,primary:!1});case"sketch-done":return this.visibleElements.sketchButton&&this._renderAction({action:t,onClick:this._onDoneButtonClick,className:m.sketchDoneButton,label:this.messagesCommon.done,primary:!0});case"select":return this._selectButtonVisible&&this._renderAction({action:t,onClick:this._onSelectButtonClick,className:m.selectButton,label:this.messages.selectButtonLabel,primary:!1});case"select-cancel":return this._selectButtonVisible&&this._renderAction({action:t,onClick:this._onCancelButtonClick,className:m.selectCancelButton,label:this.messagesCommon.cancel,primary:!1})}}).filter(Boolean);return e.length?k("footer",{class:m.footer,key:"footer"},e):null}_renderAction({action:t,className:e,label:i,onClick:s,primary:n}){return k("calcite-button",{appearance:n?"solid":"outline-fill",bind:this,class:this.classes(m.actionButton,e),disabled:t.disabled,key:`action-${t.type}`,onclick:s},i)}_onSketchButtonClick(){this.viewModel.start({mode:"sketch"})}_onSelectButtonClick(){this.viewModel.start({mode:"select"})}_onCancelButtonClick(){this.viewModel.cancel()}_onDoneButtonClick(){this.viewModel.stop()}_updateChart(t){const{data:e,chart:i,messages:s,stationary:n}=t;null!=i&&null!=s&&n&&this._canRenderChart()&&(i.update(t),this._chartIsRefined=null!=e&&e.refined)}_onChartContainerUpdate(t){this._chartContainer=t}_onChartContainerRemoved(t){this._chartContainer===t&&(this._chartContainer=null)}_initializeChart(t){n(this._chartInitTask),this._chartInitTask=e(async e=>{const{createChart:i}=await import("./ElevationProfile/support/chartUtils.js");a(e);const s=await i({container:t,abortOptions:{signal:e},onRangeChange:(t,e)=>{this._zoomOutButtonVisible=1!==t||1!==e},onCursorPositionChange:t=>{this.viewModel.hoveredChartPosition=t}});if(e.aborted)throw r(s),l();this._chart=s,this._updateChart(this._chartUpdateParams)})}_destroyChart(){this._chartInitTask=n(this._chartInitTask),this._chart=r(this._chart),this._chartIsRefined=!1}};t([d({type:_})],P.prototype,"viewModel",void 0),t([d()],P.prototype,"view",null),t([d()],P.prototype,"input",null),t([d()],P.prototype,"profiles",null),t([d()],P.prototype,"unitOptions",null),t([d()],P.prototype,"unit",null),t([d({type:v,nonNullable:!0})],P.prototype,"visibleElements",void 0),t([d()],P.prototype,"icon",null),t([d()],P.prototype,"label",null),t([d()],P.prototype,"visible",null),t([d(),w("esri/widgets/ElevationProfile/t9n/ElevationProfile")],P.prototype,"messages",void 0),t([d(),w("esri/t9n/common")],P.prototype,"messagesCommon",void 0),t([d(),w("esri/core/t9n/Units")],P.prototype,"messagesUnits",void 0),t([d()],P.prototype,"_chartContainer",void 0),t([d()],P.prototype,"_chart",void 0),t([d()],P.prototype,"_chartInitTask",void 0),t([d()],P.prototype,"_chartIsRefined",void 0),t([d()],P.prototype,"_zoomOutButtonVisible",void 0),t([d()],P.prototype,"_selectButtonVisible",null),t([d()],P.prototype,"_chartUpdateParams",null),t([d()],P.prototype,"_chartMessages",null),t([d()],P.prototype,"_profilesArray",null),P=t([p("esri.widgets.ElevationProfile")],P);const E=P;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 t from"../../../Map.js";import{rotate as i}from"../../../arcade/geometry/operators.js";import r from"../../../core/Error.js";import{EventedAccessor as a}from"../../../core/Evented.js";import s from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{isAbortError as l}from"../../../core/promiseUtils.js";import{watch as m,syncAndInitial as h,initial as d}from"../../../core/reactiveUtils.js";import{property as g,subclass as p}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../core/support/UpdatingHandles.js";import u from"../../../geometry/Point.js";import y from"../../../geometry/Polygon.js";import v from"../../../geometry/SpatialReference.js";import{e as f}from"../../../chunks/intersectionOperator.js";import{g as _}from"../../../chunks/proximityOperator.js";import w from"../../../layers/GraphicsLayer.js";import R from"../../../layers/ImageryTileLayer.js";import x from"../../../layers/support/RasterFunction.js";import{convolutionKernel as C}from"../../../layers/support/rasterFunctionConstants.js";import I from"../../../layers/support/TileInfo.js";import b from"../../../views/MapView.js";import{getResolutionToScaleFactor as j}from"../../../views/2d/viewpointUtils.js";import{castImageSource as M,logAndThrow as P,getMissingPropertyErrorName as k,getMissingPropertyErrorMessage as H}from"../utils.js";const S={click:"click-handle",enhancements:"enhancements-handle"};let V=class extends a{constructor(e){super(e),this._imageChanged=!1,this._panConstraint=null,this._image=null,this._loadController=null,this._overlays=new w({blendMode:"source-atop"}),this._map=new t,this.autoLoad=!1,this.clickAction="none",this.error=null,this.imageSource=null,this.imageRotation=0,this.navigationManager=null,this.navigationViewModel=null,this.state="ready",this.updatingHandles=new c,this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._createImageHandles=()=>{this.removeHandles(S.enhancements),this.addHandles(m(()=>[this.brightness,this.contrast,this.sharpness],([e,t,i])=>{this.image?.loaded&&(this.image.effect=`contrast(${10*(t+10)}%) brightness(${10*(e+10)}%)`,this.sharpenImage(this.image,i))},h))},this._createPanConstraint=()=>{const{image:e,imageRenderer:t}=this,r=r=>{if(!(e&&t&&r.targetGeometry&&e.serviceRasterInfo))return r;const{extent:a}=e.serviceRasterInfo,{constraints:s,rotation:o,width:n,height:l}=t,{extent:m}=i(y.fromExtent(a),o,a.center.x,a.center.y),{width:h,height:d}=m,g=r.targetGeometry.clone(),p=s.scaleToZoom(r.scale),c=1/2**p,u=n/l;let v=c*h,f=c*d;p&&(h/n>d/l?f=v/u:v=f*u);const w=m.clone();return w.xmin+=v/2,w.xmax-=v/2,w.ymin+=f/2,w.ymax-=f/2,r.targetGeometry=_(y.fromExtent(w),g).coordinate,this.state="image-loaded",r};return{constrain:r,applyPanConstraint:r}},this._createResizeHandles=e=>{e.removeHandles("resize"),e.addHandles(m(()=>{if(!this.imageRenderer.ready)return;const{extent:t}=e.serviceRasterInfo,{width:r,height:a,rotation:s}=this.imageRenderer,{extent:o}=i(y.fromExtent(t),s,t.center.x,t.center.y),{width:n,height:l}=o;return Math.max(n/r,l/a)},e=>{if(!this.imageRenderer||null==e)return;const{constraints:t,scale:i,spatialReference:r}=this.imageRenderer,a=t.minScale,s=j(r),o=.25*s,n=s*e;let l=n;const m=[];for(;l>o;)m.push(l),l/=2;m.push(l);const{lods:h}=I.create({scales:m});if(t.set({minScale:n,lods:h}),this._imageChanged)return this.imageRenderer.scale=n,void(this._imageChanged=!1);this.imageRenderer.scale=Math.abs(i-a)<=1e-6?n:i},h),"resize")},this._loadImageInternal=(e,t={})=>{this.state="image-loading",this.clearImage(),this.error=null,this._imageChanged=!0;const i="string"==typeof e,r=i?void 0:e.datasetFormat,a=i?e:e.url,{customParameters:o,options:n}=t;return this._image=new R({ioConfig:{skipExtensions:["aux.xml","jgw"],skipMapInfo:!0,datasetFormat:r},url:a,customParameters:o}),this._image.when(e=>{this._updatePanConstraint(),this._createResizeHandles(e),this._map.add(e),this.state="image-loaded"},t=>{l(t)?this.state="image-load-aborted":(this.state="image-load-error",this.error=t,s.getLogger(this).error(`error occurred while loading image ${i?e:JSON.stringify(e)}`,t),this.imageSource=null)}),this._image.load(n)},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadImage(this._loadController)},this._loadNavigationManager=async()=>{if(!this.navigationManager||this.navigationManager?.destroyed){const e=await import("../navigation/NavigationManager.js").then(e=>e.default);this.navigationManager=new e({viewModel:this.navigationViewModel})}return this.navigationManager},this._updatePanConstraint=()=>{this._panConstraint&&this.imageRenderer.constraints.customConstraints.remove(this._panConstraint),this._panConstraint=this._createPanConstraint(),this.imageRenderer.constraints.customConstraints.add(this._panConstraint)},this.addGraphic=(e,t)=>{this._overlays.graphics.add(e,t)},this.addManyGraphics=e=>{this._overlays.addMany(e)},this.clearGraphics=()=>{this._overlays.graphics.removeAll()},this.clearImage=()=>{this.image&&(this._map.layers.remove(this.image),this._image=n(this._image))},this.loadImage=e=>{const{customParameters:t,imageSource:i}=this;return i?this._loadImageInternal(i,{customParameters:t,options:e}):P(this.declaredClass,new r(k("image-viewer"),H("ImageViewerViewModel","imageSource")))},this.navigate=async(e,t)=>this.updatingHandles.addPromise(this.navigateInternal(e,t)),this.navigateInternal=async(e,t)=>{const i=await this._loadNavigationManager();return await i.navigate(e,t)},this.removeGraphic=e=>{this._overlays.remove(e)},this.removeManyGraphics=e=>{this._overlays.removeMany(e)},this._imageRenderer=new b({constraints:{snapToZoom:!0,rotationEnabled:!1},map:this._map,popupEnabled:!1,spatialReference:v.WebMercator,ui:{components:["zoom"]}})}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([m(()=>this.imageSource,e=>{e&&this.autoLoad&&this._loadWithController()},h),m(()=>this.image?.loaded,()=>{this._createImageHandles()}),m(()=>this.imageRotation,()=>{this._rotateImage()}),m(()=>this.imageRenderer.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},d),m(()=>this.imageRenderer.map.allLayers.length,e=>{e&&this.imageRenderer.map.layers.reorder(this._overlays,e-1)},h),m(()=>this.clickAction,e=>{this.removeHandles(S.click),"none"!==e&&this.addHandles(this.imageRenderer.on("click",t=>{if(this.image?.loaded&&this.imageRenderer.ready)switch(e){case"emit":t.stopPropagation(),this.emit("click",t);break;case"hittest":t.stopPropagation(),t.defer(async()=>{const e=await this.imageRenderer.hitTest(t.screenPoint,{include:this._overlays});e.results=e.results.filter(e=>"graphic"===e.type),this.emit("hittest-response",e)});break;case"pixel-location":{if(t.stopPropagation(),!this.image?.serviceRasterInfo||!t.mapPoint)return void this.emit("pixel-location",null);const{extent:e,pixelSize:i}=this.image.serviceRasterInfo,r=(t.mapPoint.x-e.xmin)*i.x,a=(e.ymax-t.mapPoint.y)*i.y,s=new u({x:r,y:a,spatialReference:e.spatialReference});this.emit("pixel-location",s);break}}}))},h)])}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",o(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",o(e,-10,10))}get currentNode(){return this.navigationViewModel?.currentNode}get image(){return this._image}get imagePointsInView(){const{extent:e,ready:t}=this.imageRenderer,r=this.imageRotation,a=this.image?.fullExtent,s=this.image?.serviceRasterInfo,o=!0===this._imageRenderer.allLayerViews.find(({layer:e})=>e===this.image)?.attached;if(!(t&&e&&a&&s&&o))return null;const n=i(y.fromExtent(e),r,e.center.x,e.center.y),l=y.fromExtent(a),m=f(n,l),{rings:h}=m;return h.flat().map(([e,t])=>({x:(e-s.extent.xmin)*s.pixelSize.x,y:(s.extent.ymax-t)*s.pixelSize.y}))}get imageSize(){const{image:e}=this;if(!e?.raster)return null;const{width:t,height:i}=e.raster.rasterInfo;return[t,i]}get imageRenderer(){return this._imageRenderer}get imageView(){return this.imageRenderer.allLayerViews.find(e=>e.layer===this.image)}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",o(e,0,1))}get updating(){return this.updatingHandles.updating}_rotateImage(){this.imageRenderer.constraints.rotationEnabled=!0,this.imageRenderer.rotation=this.imageRotation,this.imageRenderer.constraints.rotationEnabled=!1}sharpenImage(e,t){if(!t)return void(e.rasterFunction=null);const i=[0,-1*t,0,-1*t,4*t+1,-1*t,0,-1*t,0],r=new x({functionName:"Convolution",functionArguments:{type:C.userDefined,cols:3,rows:3,kernel:i,convolutionType:C.userDefined}});e.rasterFunction=r}};e([g()],V.prototype,"_image",void 0),e([g()],V.prototype,"_imageRenderer",void 0),e([g()],V.prototype,"_loadController",void 0),e([g()],V.prototype,"_overlays",void 0),e([g()],V.prototype,"_map",void 0),e([g({type:Boolean})],V.prototype,"autoLoad",void 0),e([g({type:Number})],V.prototype,"brightness",null),e([g()],V.prototype,"clickAction",void 0),e([g({type:Number})],V.prototype,"contrast",null),e([g()],V.prototype,"currentNode",null),e([g({type:Object})],V.prototype,"customParameters",void 0),e([g({type:r})],V.prototype,"error",void 0),e([g({readOnly:!0})],V.prototype,"image",null),e([g({readOnly:!0})],V.prototype,"imagePointsInView",null),e([g({readOnly:!0})],V.prototype,"imageSize",null),e([g({cast:M})],V.prototype,"imageSource",void 0),e([g({readOnly:!0})],V.prototype,"imageRenderer",null),e([g({type:Number})],V.prototype,"imageRotation",void 0),e([g()],V.prototype,"imageView",null),e([g()],V.prototype,"navigationManager",void 0),e([g()],V.prototype,"navigationViewModel",void 0),e([g({type:Number})],V.prototype,"sharpness",null),e([g()],V.prototype,"state",void 0),e([g()],V.prototype,"updatingHandles",void 0),e([g()],V.prototype,"updating",null),V=e([p("esri.widgets.OrientedImageryViewer.components.ImageViewerViewModel")],V);const E=V;export{E as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../Map.js";import{rotate as i}from"../../../arcade/geometry/operators.js";import r from"../../../core/Error.js";import{EventedAccessor as a}from"../../../core/Evented.js";import s from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{isAbortError as l}from"../../../core/promiseUtils.js";import{watch as m,syncAndInitial as h,initial as d}from"../../../core/reactiveUtils.js";import{property as g,subclass as p}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../core/support/UpdatingHandles.js";import u from"../../../geometry/Point.js";import y from"../../../geometry/Polygon.js";import v from"../../../geometry/SpatialReference.js";import{e as f}from"../../../chunks/intersectionOperator.js";import{g as _}from"../../../chunks/proximityOperator.js";import w from"../../../layers/GraphicsLayer.js";import R from"../../../layers/ImageryTileLayer.js";import x from"../../../layers/support/RasterFunction.js";import{convolutionKernel as C}from"../../../layers/support/rasterFunctionConstants.js";import I from"../../../layers/support/TileInfo.js";import b from"../../../views/MapView.js";import{getResolutionToScaleFactor as j}from"../../../views/2d/viewpointUtils.js";import{castImageSource as M,logAndThrow as P,getMissingPropertyErrorName as V,getMissingPropertyErrorMessage as k}from"../utils.js";const H={click:"click-handle",enhancements:"enhancements-handle"};let S=class extends a{constructor(e){super(e),this._imageChanged=!1,this._panConstraint=null,this._image=null,this._loadController=null,this._overlays=new w({blendMode:"source-atop"}),this._map=new t,this.autoLoad=!1,this.clickAction="none",this.error=null,this.imageSource=null,this.imageRotation=0,this.navigationManager=null,this.navigationViewModel=null,this.state="ready",this.updatingHandles=new c,this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._createImageHandles=()=>{this.removeHandles(H.enhancements),this.addHandles(m(()=>[this.brightness,this.contrast,this.sharpness],([e,t,i])=>{this.image?.loaded&&(this.image.effect=`contrast(${10*(t+10)}%) brightness(${10*(e+10)}%)`,this.sharpenImage(this.image,i))},h))},this._createPanConstraint=()=>{const{image:e,imageRenderer:t}=this,r=r=>{if(!(e&&t&&r.targetGeometry&&e.serviceRasterInfo))return r;const{extent:a}=e.serviceRasterInfo,{constraints:s,rotation:o,width:n,height:l}=t,{extent:m}=i(y.fromExtent(a),o,a.center.x,a.center.y),{width:h,height:d}=m,g=r.targetGeometry.clone(),p=s.scaleToZoom(r.scale),c=1/2**p,u=n/l;let v=c*h,f=c*d;p&&(h/n>d/l?f=v/u:v=f*u);const w=m.clone();return w.xmin+=v/2,w.xmax-=v/2,w.ymin+=f/2,w.ymax-=f/2,r.targetGeometry=_(y.fromExtent(w),g).coordinate,this.state="image-loaded",r};return{constrain:r,applyPanConstraint:r}},this._createResizeHandles=e=>{e.removeHandles("resize"),e.addHandles(m(()=>{if(!this.imageRenderer.ready)return;const{extent:t}=e.serviceRasterInfo,{width:r,height:a,rotation:s}=this.imageRenderer,{extent:o}=i(y.fromExtent(t),s,t.center.x,t.center.y),{width:n,height:l}=o;return Math.max(n/r,l/a)},e=>{if(!this.imageRenderer||null==e)return;const{constraints:t,scale:i,spatialReference:r}=this.imageRenderer,a=t.minScale,s=j(r),o=.25*s,n=s*e;let l=n;const m=[];for(;l>o;)m.push(l),l/=2;m.push(l);const{lods:h}=I.create({scales:m});if(t.set({minScale:n,lods:h}),this._imageChanged)return this.imageRenderer.scale=n,void(this._imageChanged=!1);this.imageRenderer.scale=Math.abs(i-a)<=1e-6?n:i},h),"resize")},this._loadImageInternal=(e,t={})=>{this.state="image-loading",this.clearImage(),this.error=null,this._imageChanged=!0;const i="string"==typeof e,r=i?void 0:e.datasetFormat,a=i?e:e.url,{customParameters:o,options:n}=t;return this._image=new R({ioConfig:{skipExtensions:["aux.xml","jgw"],skipMapInfo:!0,datasetFormat:r},url:a,customParameters:o}),this._image.when(e=>{this._updatePanConstraint(),this._createResizeHandles(e),this._map.add(e),this.state="image-loaded"},t=>{l(t)?this.state="image-load-aborted":(this.state="image-load-error",this.error=t,s.getLogger(this).error(`error occurred while loading image ${i?e:JSON.stringify(e)}`,t),this.imageSource=null)}),this._image.load(n)},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadImage(this._loadController)},this._loadNavigationManager=async()=>{if(!this.navigationManager||this.navigationManager?.destroyed){const e=await import("../navigation/NavigationManager.js").then(e=>e.default);this.navigationManager=new e({viewModel:this.navigationViewModel})}return this.navigationManager},this._updatePanConstraint=()=>{this._panConstraint&&this.imageRenderer.constraints.customConstraints.remove(this._panConstraint),this._panConstraint=this._createPanConstraint(),this.imageRenderer.constraints.customConstraints.add(this._panConstraint)},this.addGraphic=(e,t)=>{this._overlays.graphics.add(e,t)},this.addManyGraphics=e=>{this._overlays.addMany(e)},this.clearGraphics=()=>{this._overlays.graphics.removeAll()},this.clearImage=()=>{this.image&&(this._map.layers.remove(this.image),this._image=n(this._image))},this.loadImage=e=>{const{customParameters:t,imageSource:i}=this;return i?this._loadImageInternal(i,{customParameters:t,options:e}):P(this.declaredClass,new r(V("image-viewer"),k("ImageViewerViewModel","imageSource")))},this.navigate=async(e,t)=>this.updatingHandles.addPromise(this.navigateInternal(e,t)),this.navigateInternal=async(e,t)=>{const i=await this._loadNavigationManager();return await i.navigate(e,t)},this.removeGraphic=e=>{this._overlays.remove(e)},this.removeManyGraphics=e=>{this._overlays.removeMany(e)},this._imageRenderer=new b({constraints:{snapToZoom:!0,rotationEnabled:!1},map:this._map,popupEnabled:!1,spatialReference:v.WebMercator,attributionVisible:!1})}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([m(()=>this.imageSource,e=>{e&&this.autoLoad&&this._loadWithController()},h),m(()=>this.image?.loaded,()=>{this._createImageHandles()}),m(()=>this.imageRotation,()=>{this._rotateImage()}),m(()=>this.imageRenderer.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},d),m(()=>this.imageRenderer.map.allLayers.length,e=>{e&&this.imageRenderer.map.layers.reorder(this._overlays,e-1)},h),m(()=>this.clickAction,e=>{this.removeHandles(H.click),"none"!==e&&this.addHandles(this.imageRenderer.on("click",t=>{if(this.image?.loaded&&this.imageRenderer.ready)switch(e){case"emit":t.stopPropagation(),this.emit("click",t);break;case"hittest":t.stopPropagation(),t.defer(async()=>{const e=await this.imageRenderer.hitTest(t.screenPoint,{include:this._overlays});e.results=e.results.filter(e=>"graphic"===e.type),this.emit("hittest-response",e)});break;case"pixel-location":{if(t.stopPropagation(),!this.image?.serviceRasterInfo||!t.mapPoint)return void this.emit("pixel-location",null);const{extent:e,pixelSize:i}=this.image.serviceRasterInfo,r=(t.mapPoint.x-e.xmin)*i.x,a=(e.ymax-t.mapPoint.y)*i.y,s=new u({x:r,y:a,spatialReference:e.spatialReference});this.emit("pixel-location",s);break}}}))},h)])}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",o(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",o(e,-10,10))}get currentNode(){return this.navigationViewModel?.currentNode}get image(){return this._image}get imagePointsInView(){const{extent:e,ready:t}=this.imageRenderer,r=this.imageRotation,a=this.image?.fullExtent,s=this.image?.serviceRasterInfo,o=!0===this._imageRenderer.allLayerViews.find(({layer:e})=>e===this.image)?.attached;if(!(t&&e&&a&&s&&o))return null;const n=i(y.fromExtent(e),r,e.center.x,e.center.y),l=y.fromExtent(a),m=f(n,l),{rings:h}=m;return h.flat().map(([e,t])=>({x:(e-s.extent.xmin)*s.pixelSize.x,y:(s.extent.ymax-t)*s.pixelSize.y}))}get imageSize(){const{image:e}=this;if(!e?.raster)return null;const{width:t,height:i}=e.raster.rasterInfo;return[t,i]}get imageRenderer(){return this._imageRenderer}get imageView(){return this.imageRenderer.allLayerViews.find(e=>e.layer===this.image)}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",o(e,0,1))}get updating(){return this.updatingHandles.updating}_rotateImage(){this.imageRenderer.constraints.rotationEnabled=!0,this.imageRenderer.rotation=this.imageRotation,this.imageRenderer.constraints.rotationEnabled=!1}sharpenImage(e,t){if(!t)return void(e.rasterFunction=null);const i=[0,-1*t,0,-1*t,4*t+1,-1*t,0,-1*t,0],r=new x({functionName:"Convolution",functionArguments:{type:C.userDefined,cols:3,rows:3,kernel:i,convolutionType:C.userDefined}});e.rasterFunction=r}};e([g()],S.prototype,"_image",void 0),e([g()],S.prototype,"_imageRenderer",void 0),e([g()],S.prototype,"_loadController",void 0),e([g()],S.prototype,"_overlays",void 0),e([g()],S.prototype,"_map",void 0),e([g({type:Boolean})],S.prototype,"autoLoad",void 0),e([g({type:Number})],S.prototype,"brightness",null),e([g()],S.prototype,"clickAction",void 0),e([g({type:Number})],S.prototype,"contrast",null),e([g()],S.prototype,"currentNode",null),e([g({type:Object})],S.prototype,"customParameters",void 0),e([g({type:r})],S.prototype,"error",void 0),e([g({readOnly:!0})],S.prototype,"image",null),e([g({readOnly:!0})],S.prototype,"imagePointsInView",null),e([g({readOnly:!0})],S.prototype,"imageSize",null),e([g({cast:M})],S.prototype,"imageSource",void 0),e([g({readOnly:!0})],S.prototype,"imageRenderer",null),e([g({type:Number})],S.prototype,"imageRotation",void 0),e([g()],S.prototype,"imageView",null),e([g()],S.prototype,"navigationManager",void 0),e([g()],S.prototype,"navigationViewModel",void 0),e([g({type:Number})],S.prototype,"sharpness",null),e([g()],S.prototype,"state",void 0),e([g()],S.prototype,"updatingHandles",void 0),e([g()],S.prototype,"updating",null),S=e([p("esri.widgets.OrientedImageryViewer.components.ImageViewerViewModel")],S);const E=S;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 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 m}from"../../core/mathUtils.js";import{destroyMaybe as l}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 F}from"../OrientedImageryViewer/utils.js";import{defaultImageSphereCenter as C,maxPanoramicViewerHFOV as b,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:C},environment:{atmosphereEnabled:!1,starsEnabled:!1,lighting:{type:"virtual"}},popupEnabled:!1,spatialReference:w.WebMercator,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(m(e/2))*Math.sin(a)))}get imageRenderer(){return this._imageRenderer}get maxHFOV(){const{size:[e,t]}=this.imageRenderer;return this.imageRenderer.ready?x(b,e/t):b}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(m(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=l(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"),F("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(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};
|