@arcgis/core 4.25.0-next.20220718 → 4.25.0-next.20220721
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/Camera.js +1 -1
- package/analysis/DimensioningAnalysis.js +1 -1
- package/analysis/LineOfSightAnalysis.js +1 -1
- package/analysis/SliceAnalysis.js +1 -1
- package/arcade/featureset/support/RecentlyUsedCache.js +1 -1
- package/arcade/functions/featuresetgeom.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/1751de504354d98ac3fd.js +1 -0
- package/assets/esri/core/workers/chunks/1f4f1896880bfa6801c5.js +1 -0
- package/assets/esri/core/workers/chunks/290cd411d0d18b1d0efd.js +1 -0
- package/assets/esri/core/workers/chunks/{ab3bd5fecdb97f2d690e.js → 3b5be512567d9c1c6fe6.js} +1 -1
- package/assets/esri/core/workers/chunks/{c3236a7058e64ea3b939.js → 3c9da9b88777700879aa.js} +1 -1
- package/assets/esri/core/workers/chunks/{f96e8724ae3458f5e262.js → 4a7aa1b9de61eb013647.js} +1 -1
- package/assets/esri/core/workers/chunks/4cb64ccb5fba126f9a66.js +1 -0
- package/assets/esri/core/workers/chunks/{68f19e58aae01791944e.js → 579ba109718bc2554008.js} +1 -1
- package/assets/esri/core/workers/chunks/59845b02b07a8ed7ce81.js +1 -0
- package/assets/esri/core/workers/chunks/{c705f907ce60a646d9aa.js → 652d36523efbe5c9ebb2.js} +1 -1
- package/assets/esri/core/workers/chunks/888d8e4471c9a2cd5009.js +1 -0
- package/assets/esri/core/workers/chunks/9493a8e5d6001b6bf275.js +1 -0
- package/assets/esri/core/workers/chunks/9d824cdfbcdf3cb3246f.js +1 -0
- package/assets/esri/core/workers/chunks/bf348f6f52701fa6016e.js +987 -0
- package/assets/esri/core/workers/chunks/d02881954c0cc0d39dfb.js +1 -0
- package/assets/esri/core/workers/chunks/{1ecbf642debc2207b762.js → da54483123f377e9b3e1.js} +1 -1
- package/assets/esri/core/workers/chunks/{61b71b8e028eda10ccab.js → e4ad2cf5d6bded02e392.js} +1 -1
- package/assets/esri/core/workers/chunks/{3bfab05ae07ac18a75fe.js → f298a70f3b6f27675d53.js} +1 -1
- package/assets/esri/core/workers/chunks/{d499cce61c1c5c367380.js → f40290cfad3fe6fb4ef9.js} +1 -1
- package/assets/esri/layers/support/rasterFormats/lerc-wasm.wasm +0 -0
- package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -1
- 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/ComponentShader.glsl.js +39 -33
- package/chunks/Laserlines.glsl.js +4 -4
- package/chunks/Precipitation.glsl.js +2 -2
- package/chunks/RibbonLine.glsl.js +46 -44
- package/chunks/Stars.glsl.js +2 -2
- package/chunks/Terrain.glsl.js +25 -17
- package/chunks/boundedPlane.js +1 -1
- package/chunks/lerc-wasm.js +1 -1
- package/chunks/mat2d.js +1 -1
- package/chunks/quatf32.js +1 -1
- package/core/BidiEngine.js +1 -1
- package/core/accessorSupport/watch.js +1 -1
- package/core/libs/gl-matrix-2/factories/quatf32.js +1 -1
- package/core/libs/gl-matrix-2/math/mat2d.js +1 -1
- package/core/perspectiveUtils.js +1 -1
- package/core/promiseUtils.js +1 -1
- package/core/reactiveUtils.js +1 -1
- package/core/unitUtils.js +1 -1
- package/geometry/projection.js +1 -1
- package/geometry/projectionEllipsoid.js +1 -1
- package/geometry/support/MeshTexture.js +1 -1
- package/geometry/support/axisAngleDegrees.js +1 -1
- package/geometry/support/coordinateSystem.js +1 -1
- package/geometry/support/geodesicUtils.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/index.js +1 -1
- package/geometry/support/meshUtils/loadExternal.js +1 -1
- package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
- package/geometry/support/scaleUtils.js +1 -1
- package/geometry/support/spatialReferenceUtils.js +1 -1
- package/identity/IdentityManagerBase.js +1 -1
- package/identity/IdentityModal.js +1 -1
- package/interfaces.d.ts +3 -33
- package/layers/FeatureLayer.js +1 -1
- package/layers/effects/parser.js +1 -1
- package/layers/graphics/hydratedFeatures.js +1 -1
- package/layers/graphics/sources/support/sourceUtils.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/ogc/wfsUtils.js +1 -1
- package/layers/support/ContingentValue.js +1 -1
- package/layers/support/ElevationQuery.js +1 -1
- package/layers/support/PixelBlock.js +1 -1
- package/layers/support/kmlUtils.js +1 -1
- package/layers/support/rasterDatasets/CloudRaster.js +1 -1
- package/layers/support/rasterDatasets/EphemeralBlockCache.js +1 -1
- package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
- package/layers/support/rasterDatasets/multipartParser.js +1 -1
- package/layers/support/rasterFormats/ImageCanvasDecoder.js +1 -1
- package/layers/support/rasterFormats/JpgPlus.js +1 -1
- package/layers/support/rasterFormats/Lerc.js +1 -1
- package/layers/support/rasterFormats/RasterCodec.js +1 -1
- package/layers/support/rasterFormats/Raw.js +1 -1
- package/layers/support/rasterFormats/TiffTags.js +1 -1
- package/layers/support/rasterFunctions/vectorFieldUtils.js +1 -1
- package/layers/support/vectorTileLayerLoader.js +1 -1
- package/layers/support/wmtsUtils.js +1 -1
- package/package.json +1 -1
- package/renderers/RasterShadedReliefRenderer.js +1 -1
- package/renderers/RasterStretchRenderer.js +1 -1
- package/renderers/UniqueValueRenderer.js +1 -1
- package/renderers/support/AuthoringInfo.js +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/query/operations/queryTopFeatures.js +1 -1
- package/rest/support/DirectionsFeatureSet.js +1 -1
- package/rest/support/ImageHistogramParameters.js +1 -1
- package/rest/support/ImageSampleParameters.js +1 -1
- package/smartMapping/labels/clusters.js +1 -1
- package/smartMapping/renderers/relationship.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/support/basemapUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/LabelSymbol3D.js +1 -1
- package/symbols/PointSymbol3D.js +1 -1
- package/symbols/cim/CIMCursor.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/CIMSymbolRasterizer.js +1 -1
- package/symbols/support/previewSymbol3D.js +1 -1
- package/symbols/support/webStyleSymbolUtils.js +1 -1
- package/views/2d/ViewState.js +1 -1
- package/views/2d/engine/vectorTiles/Feature.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
- package/views/2d/engine/webgl/SDFConverter.js +1 -1
- package/views/2d/engine/webgl/TurboLine.js +1 -1
- package/views/2d/engine/webgl/brushes/BrushClip.js +1 -1
- package/views/2d/engine/webgl/brushes/BrushOverlay.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushLabel.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushLine.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushText.js +1 -1
- package/views/2d/engine/webgl/collisions/MetricReader.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/DisplayRecordReader.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/FreeList.js +1 -1
- package/views/2d/engine/webgl/mesh/heuristics.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLDynamicFillTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLDynamicLineTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLDynamicMarkerTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLDynamicTextTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLFillTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLLineTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLMarkerTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/input/MapViewInputManager.js +1 -1
- package/views/2d/layers/features/createSymbolSchema.js +1 -1
- package/views/2d/viewpointUtils.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightVisualization.js +1 -1
- package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/camera/constraintUtils/distance.js +1 -1
- package/views/3d/environment/ChapmanAtmosphereTechniqueConfiguration.js +1 -1
- package/views/3d/environment/CloudsComposition.js +1 -1
- package/views/3d/environment/FogTechnique.js +1 -1
- package/views/3d/glTF/internal/Resource.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateObjectSymbol3DAdapter.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/GraphicsLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/lineUtils.js +1 -1
- package/views/3d/layers/i3s/I3SGeometryUtil.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/IDBCache.js +1 -1
- package/views/3d/layers/i3s/IDBMockCache.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/terrain/Overlay.js +1 -1
- package/views/3d/terrain/OverlayRenderTarget.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TilingSchemeLogic.js +1 -1
- package/views/3d/terrain/interfaces.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
- package/views/3d/webgl-engine/collections/Component/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +9 -0
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +18 -17
- package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/ObjectAndLayerIdRenderHelper.js +5 -0
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
- package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/RenderInstanceData.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/LaserlinePathTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/MapView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/View.js +1 -1
- package/views/analysis/analysisViewUtils.js +1 -1
- package/views/animation/pointToPoint/apex/planning.js +1 -1
- package/views/draw/PolygonDrawAction.js +1 -1
- package/views/draw/PolylineDrawAction.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/draw/support/surfaceCoordinateSystems.js +1 -1
- package/views/input/InputManager.js +1 -1
- package/views/input/handlers/LatestPointer.js +1 -1
- package/views/input/handlers/MultiTouch.js +5 -0
- package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
- package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileCache.js +1 -1
- package/views/interactive/tooltip/Tooltip.js +1 -1
- package/views/interactive/tooltip/support/measurements.js +1 -1
- package/views/layers/GroupLayerView.js +1 -1
- package/views/navigation/FilteredFiniteDifference.js +1 -1
- package/views/navigation/MomentumEstimator.js +1 -1
- package/views/navigation/PanPlanarMomentumEstimator.js +1 -1
- package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
- package/views/navigation/RotationMomentumEstimator.js +1 -1
- package/views/support/GroundViewElevationSampler.js +1 -1
- package/views/support/euclideanAreaMeasurementUtils.js +1 -1
- package/views/support/euclideanLengthMeasurementUtils.js +1 -1
- package/views/support/screenshotUtils.js +1 -1
- package/views/webgl/BufferObject.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/capabilities/Capabilities.js +1 -1
- package/views/webgl/capabilities.js +1 -1
- package/views/webgl/renderState.js +1 -1
- package/webscene/spec-certification/api.js +1 -1
- package/widgets/CoordinateConversion/support/formatUtils.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLineInput.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/Legend/support/sizeRampUtils.js +1 -1
- package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
- package/widgets/Popup/PopupViewModel.js +1 -1
- package/widgets/Popup/actionUtils.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Slider/SliderViewModel.js +1 -1
- package/widgets/Widget.js +1 -1
- package/assets/esri/core/workers/chunks/04ea469cb081e181ca82.js +0 -1
- package/assets/esri/core/workers/chunks/16c2626ca47132700519.js +0 -1
- package/assets/esri/core/workers/chunks/1e4e5d147263e98536bc.js +0 -1
- package/assets/esri/core/workers/chunks/35083def3c658d1ae9ff.js +0 -1
- package/assets/esri/core/workers/chunks/40032d2bf404a46b8f80.js +0 -1
- package/assets/esri/core/workers/chunks/613e82a3e13442685ac4.js +0 -1
- package/assets/esri/core/workers/chunks/64b4f1dbf61439cde801.js +0 -1
- package/assets/esri/core/workers/chunks/abd68b7ba3be4696611c.js +0 -1
- package/assets/esri/core/workers/chunks/b8a062c0c9c626acf61e.js +0 -982
- package/assets/esri/core/workers/chunks/e08686088be0aaca1a99.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getCustoms as t,
|
|
5
|
+
import{getCustoms as t,format as e,parse as i}from"../../../core/number.js";import{getLocale as a}from"../../../intl/locale.js";import n from"./Format.js";const s=t().decimal,r={N:"north",S:"south",E:"east",W:"west"},o=`°${""}`,d=new RegExp(`-?\\d+[\\.|\\${s}]?\\d*`),u=/^[\\0]+(?=\d)/;function c(t,e){const i="ar"===a(),n={ddm:`Y${o} A'${t.abbreviatedDirections.north}, X${o} B'${t.abbreviatedDirections.east}`,dms:`Y${o} A' B"${t.abbreviatedDirections.north}, X${o} C' D"${t.abbreviatedDirections.east}`,dd:`Y${o}${t.abbreviatedDirections.north}, X${o}${t.abbreviatedDirections.east}`,xy:`X${o}, Y${o}`,basemap:"X, Y"},s={ddm:`${t.abbreviatedDirections.north}${o}Y 'A ,${t.abbreviatedDirections.east}${o}X 'B`,dms:`${t.abbreviatedDirections.north}${o}Y 'A "B ,${t.abbreviatedDirections.east}${o}X 'C "D`,dd:`${t.abbreviatedDirections.north}${o}Y ,${t.abbreviatedDirections.east}${o}X`,xy:`X${o} ,Y${o}`,basemap:"X ,Y"};e.forEach((t=>{const{name:e}=t;if(n[e]){const a=t.defaultPattern===t.currentPattern,r=i?s[e]:n[e];t.defaultPattern=r,a&&(t.currentPattern=r)}}))}function p(t){const e=t.abbreviatedDirections.north,i=t.abbreviatedDirections.south,a=t.abbreviatedDirections.east,u=t.abbreviatedDirections.west,p={};p[e]="N",p[i]="S",p[a]="E",p[u]="W";const $=new RegExp(`N|S|${e}|${i}`,"i"),h=new RegExp(`E|W|${a}|${u}`,"i"),g=[new n({name:"basemap",coordinateSegments:[{alias:"X",description:"easting",searchPattern:d,substitution:{input:t=>l(t),output:t=>b(t)}},{alias:"Y",description:"northing",searchPattern:d,substitution:{input:t=>l(t),output:t=>b(t)}}],defaultPattern:"X, Y",viewModel:null}),new n({name:"dd",coordinateSegments:[{alias:"Y",description:"degrees latitude",searchPattern:new RegExp(`\\d{1,2}[\\.|\\${s}]?\\d*(?=\\D*?[N|S|${e}|${i}])`,"i"),substitution:{input:t=>l(t),output:t=>b(t)}},{alias:t.abbreviatedDirections.north,description:"north/south indicator",searchPattern:$,substitution:{input:t=>p[t],output:e=>t.abbreviatedDirections[r[e]]}},{alias:"X",description:"degrees longitude",searchPattern:new RegExp(`\\d{1,3}[\\.|\\${s}]?\\d*(?=\\D*?[E|W|${a}|${u}])`,"i"),substitution:{input:t=>l(t),output:t=>b(t)}},{alias:t.abbreviatedDirections.east,description:"east/west indicator",searchPattern:h,substitution:{input:t=>p[t],output:e=>t.abbreviatedDirections[r[e]]}}],defaultPattern:`Y${o}${t.abbreviatedDirections.north}, X${o}${t.abbreviatedDirections.east}`,viewModel:null}),new n({name:"ddm",coordinateSegments:[{alias:"Y",description:"degrees latitude",searchPattern:new RegExp(`\\d{1,2}(?=.*?\\s+.*?[N|S|${e}|${i}])`,"i"),substitution:{input:t=>l(t),output:t=>b(t)}},{alias:"A",description:"minutes latitude",searchPattern:new RegExp(`\\d{1,2}[\\.\\${s}]?\\d*(?=.*?[N|S|${e}||${i}])`,"i"),substitution:{input:t=>l(t),output:t=>b(t)}},{alias:t.abbreviatedDirections.north,description:"north/south indicator",searchPattern:$,substitution:{input:t=>p[t],output:e=>t.abbreviatedDirections[r[e]]}},{alias:"X",description:"degrees longitude",searchPattern:new RegExp(`\\d{1,3}(?=\\D*?\\s+.*?[E|W|${a}|${u}])`,"i"),substitution:{input:t=>l(t),output:t=>b(t)}},{alias:"B",description:"minutes longitude",searchPattern:new RegExp(`\\d{1,2}[\\.|\\|${s}]?\\d*(?=.*?[E|W|${a}|${u}])`,"i"),substitution:{input:t=>l(t),output:t=>b(t)}},{alias:t.abbreviatedDirections.east,description:"east/west indicator",searchPattern:h,substitution:{input:t=>p[t],output:e=>t.abbreviatedDirections[r[e]]}}],defaultPattern:`Y${o} A'${t.abbreviatedDirections.north}, X${o} B'${t.abbreviatedDirections.east}`,viewModel:null}),new n({name:"dms",coordinateSegments:[{alias:"Y",description:"degrees latitude",searchPattern:new RegExp(`\\d{1,2}(?=.*?\\s+.*?[N|S|${e}|${i}])`,"i"),substitution:{input:t=>l(t),output:t=>b(t)}},{alias:"A",description:"minutes latitude",searchPattern:new RegExp(`\\d{1,2}(?=.*?[N|S|${e}|${i}])`,"i"),substitution:{input:t=>l(t),output:t=>b(t)}},{alias:"B",description:"seconds latitude",searchPattern:new RegExp(`\\d{1,2}[\\.|\\${s}]?\\d*(?=.*?[N|S|${e}|${i}])`,"i"),substitution:{input:t=>l(t),output:t=>b(t)}},{alias:t.abbreviatedDirections.north,description:"north/south indicator",searchPattern:$,substitution:{input:t=>p[t],output:e=>t.abbreviatedDirections[r[e]]}},{alias:"X",description:"degrees longitude",searchPattern:new RegExp(`\\d{1,3}(?=.*?\\s+.*?[E|W|${a}|${u}])`,"i"),substitution:{input:t=>l(t),output:t=>b(t)}},{alias:"C",description:"minutes longitude",searchPattern:new RegExp(`\\d{1,2}(?=.*?[E|W|${a}|${u}])`,"i"),substitution:{input:t=>l(t),output:t=>b(t)}},{alias:"D",description:"seconds longitude",searchPattern:new RegExp(`\\d{1,2}[\\.|\\${s}]?\\d*(?=.*?[E|W|${a}|${u}])`,"i"),substitution:{input:t=>l(t),output:t=>b(t)}},{alias:t.abbreviatedDirections.east,description:"east/west indicator",searchPattern:h,substitution:{input:t=>p[t],output:e=>t.abbreviatedDirections[r[e]]}}],defaultPattern:`Y${o} A' B"${t.abbreviatedDirections.north}, X${o} C' D"${t.abbreviatedDirections.east}`,viewModel:null}),new n({name:"xy",coordinateSegments:[{alias:"X",description:"longitude",searchPattern:d,substitution:{input:t=>l(t),output:t=>b(t)}},{alias:"Y",description:"latitude",searchPattern:d,substitution:{input:t=>l(t),output:t=>b(t)}}],defaultPattern:`X${o}, Y${o}`,viewModel:null}),new n({name:"mgrs",coordinateSegments:[{alias:"Z",description:"grid zone",searchPattern:/\d{1,2}\w|[abyz]/i},{alias:"S",description:"grid square",searchPattern:/\w{2}/},{alias:"X",description:"easting",searchPattern:/^\d{5}(?=.?\d{5}$)|^\d{4}(?=.?\d{4}$)|^\d{3}(?=.?\d{3}$)|^\d{2}(?=.?\d{2}$)|^\d(?=.?\d$)/},{alias:"Y",description:"northing",searchPattern:/^\d{1,5}/}],defaultPattern:"Z S X Y",viewModel:null}),new n({name:"usng",coordinateSegments:[{alias:"Z",description:"grid zone",searchPattern:/\d{1,2}\w|[abyz]/i},{alias:"S",description:"grid square",searchPattern:/\w{2}/},{alias:"X",description:"easting",searchPattern:/^\d{5}(?=.?\d{5}$)|^\d{4}(?=.?\d{4}$)|^\d{3}(?=.?\d{3}$)|^\d{2}(?=.?\d{2}$)|^\d(?=.?\d$)/},{alias:"Y",description:"northing",searchPattern:/^\d{1,5}/}],defaultPattern:"Z S X Y",viewModel:null}),new n({name:"utm",coordinateSegments:[{alias:"Z",description:"zone number",searchPattern:/\d{1,2}|[abyz]/i},{alias:"B",description:"latitude band",searchPattern:/^\D/},{alias:"X",description:"easting",searchPattern:/\d{1,7}(?=\s*\d{7}$)/},{alias:"Y",description:"northing",searchPattern:/\d{1,7}/}],defaultPattern:"ZB X Y",viewModel:null})];return c(t,g),g}function b(t){const i=t.match(u),a=i?i[0]:"",n=t.includes(".")?t.split(".")[1].length:0;return a+e(Number(t),{pattern:"###0.###",places:n,round:-1})}function l(t){return i(t)}export{p as generateDefaultFormats,c as setDefaultPatterns};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{createTask as o}from"../../core/asyncUtils.js";import s from"../../core/Handles.js";import{handlesGroup as r}from"../../core/handleUtils.js";import{
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{createTask as o}from"../../core/asyncUtils.js";import s from"../../core/Handles.js";import{handlesGroup as r}from"../../core/handleUtils.js";import{isSome as i,isNone as a,applySome as l,unwrapOr as n,abortMaybe as p}from"../../core/maybe.js";import{memoize as m}from"../../core/memoize.js";import{ignoreAbortErrors as d,throwIfAborted as h,throwIfAbortError as c}from"../../core/promiseUtils.js";import{watch as u,syncAndInitial as f}from"../../core/reactiveUtils.js";import{throttle as _}from"../../core/throttle.js";import{property as P}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import{hasGraphicFeatureExpressionInfo as g,getGraphicEffectiveElevationInfo as M}from"../../support/elevationInfoUtils.js";import{getConfig as y}from"./support/constants.js";import{isPolyline as j,isValidInputPath as w}from"./support/geometryUtils.js";import{generateProfiles as T}from"./support/profileUtils.js";const U="line-change";let b=class extends t{constructor(e){super(e),this._handles=new s,this._updateTask=null,this._paramsPerProfile=new Map,this._getUpdateParametersMemoized=m(((e,t,o)=>({stationary:e,visibleProfiles:t,generationParameters:o}))),this._getGenerationParametersMemoized=m(((e,t,o,s,r,i,l)=>j(t)&&w(t)&&!a(s)?{view:e,geometry:t,elevationInfo:o,options:i,queue:s,cache:r,slicePlane:l}:null)),this._getElevationInfoMemoized=m(((e,t)=>({mode:e,offset:t}))),this._getOptionsMemoized=m(((e,t,o)=>{const{densificationMaxSamples:s,maxTotalSamples:r}=y();return{geodesicDistanceThreshold:e,samplingDistance:t,densificationMaxSamples:Math.round(s/o),maxTotalSamples:r}})),this._updateThrottled=_((e=>d(this._update(e))),y().updateThrottleMillis)}initialize(){const e=this.viewModel;this._handles.add([u((()=>e.profiles.toArray()),(e=>{this._abortUpdate(),this._paramsPerProfile.clear(),this._handles.remove(U),this._handles.add(e.map((e=>r([e.attach(this.viewModel),e.on("change",(()=>{this._invalidateProfile(e)}))]))),U)}),f),this._updateThrottled,u((()=>this._updateParameters),this._updateThrottled,f)])}destroy(){this._handles.destroy(),this._paramsPerProfile.clear()}get _updateParameters(){const{viewModel:e}=this,t=e.view;return this._getUpdateParametersMemoized(!i(t)||t.stationary,this.viewModel.visibleProfiles,this._generationParameters)}get _generationParameters(){const{view:e,input:t,queue:o,tileCache:s}=this.viewModel;return a(e)||!e.ready?null:this._getGenerationParametersMemoized(e,l(t,(e=>e.geometry)),this._elevationInfo,o,s,this._options,"3d"===e.type?e.slicePlane:null)}get _elevationInfo(){const e=l(this.viewModel.input,(e=>g(e)?null:M(e)));return i(e)?this._getElevationInfoMemoized(e.mode,e.offset):null}get _options(){const e=this.viewModel,t=e.visibleProfiles.length;let o=n(e.minDemResolution,y().defaultDemResolution);return o=parseFloat(o.toFixed(2)),this._getOptionsMemoized(e.geodesicDistanceThreshold,o,t)}async _update({stationary:e,visibleProfiles:t,generationParameters:s}){this._abortUpdate(),e&&(a(s)?this._clearResults():this._updateTask=o((async e=>{this.viewModel.error=null;const o=t.filter((e=>!this._isProfileValid(e,s))),r=T({...s,providers:o},{signal:e});try{for await(const t of r){h(e),this._clearInvalidResults(s);for(let e=0;e<o.length;e++)o[e].result=t[e]}for(const e of o)this._paramsPerProfile.set(e,s)}catch(i){c(i),this._abortUpdate(),this.viewModel.error=i,o.forEach((e=>{e.result=null}))}})))}_abortUpdate(){this._updateTask=p(this._updateTask)}_isProfileValid(e,t){return this._paramsPerProfile.has(e)&&this._paramsPerProfile.get(e)===t}_invalidateProfile(e){this._paramsPerProfile.delete(e),this._updateThrottled(this._updateParameters)}_clearInvalidResults(e){for(const t of this.viewModel.profiles.items)this._isProfileValid(t,e)||(t.result=null,this._paramsPerProfile.delete(t))}_clearResults(){for(const e of this.viewModel.profiles.items)e.result=null,this._paramsPerProfile.delete(e)}};e([P({nonNullable:!0})],b.prototype,"viewModel",void 0),e([P()],b.prototype,"_updateParameters",null),e([P()],b.prototype,"_generationParameters",null),e([P()],b.prototype,"_elevationInfo",null),e([P()],b.prototype,"_options",null),b=e([v("esri.widgets.ElevationProfile.ElevationProfileController")],b);export{b as ElevationProfileController};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Color.js";import{handlesGroup as o}from"../../core/handleUtils.js";import{
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Color.js";import{handlesGroup as o}from"../../core/handleUtils.js";import{isNone as r,applySome as i,unwrapOr as n}from"../../core/maybe.js";import{memoize as s}from"../../core/memoize.js";import{watch as a,on as l}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{GeometryDescriptor as u}from"../../layers/support/ElevationQuery.js";import{getGraphicEffectiveElevationInfo as v}from"../../support/elevationInfoUtils.js";import m from"./ElevationProfileLine.js";let y=class extends m{constructor(e){super(e),this.type="input",this.color=new t("#00c8c8"),this.viewVisualizationEnabled=!1,this.numSamplesForPreview=50,this.numSamplesPerChunk=500,this.chartFillEnabled=!1,this.chartStrokeOffsetY=-1,this._getQueryElevationDependencies=s(((e,t,o,r,n)=>i(e,(e=>({elevationInfo:e,visibleLayers:t,view:o,stationary:r,spatialReference:n})))))}get queryElevationDependencies(){const e=this._viewModel.view;return r(e)?null:this._getQueryElevationDependencies(this._elevationInfo,this._visibleLayers,e,e.stationary,e.spatialReference)}get available(){return!this._viewModel.inputIsSketched}get _elevationInfo(){return i(this._viewModel.input,v)}get _visibleLayers(){const e=this._viewModel?.view,t=i(e,(e=>e.map?.allLayers?.filter((e=>e.visible)).toArray()));return n(t,[])}async queryElevation(e,{noDataValue:t,signal:o}){const i=this.queryElevationDependencies;if(r(i))throw new Error("ElevationProfileLineInput: no dependencies");const{view:s,elevationInfo:a,spatialReference:l}=i;if("on-the-ground"===a.mode&&"3d"===s.type){const r=await u.fromGeometry(e).project(l,o),i=s.elevationProvider;return r.coordinates.forEach((e=>{e.z=n(i.getElevation(e.x,e.y,0,l,"ground"),0)})),{geometry:r.export(),noDataValue:t}}return{geometry:e,noDataValue:t}}attach(e){const t=()=>this._onChange();return o([super.attach(e),a((()=>this.queryElevationDependencies),t),l((()=>e.elevationProvider),"elevation-change",t,{onListenerAdd:t,onListenerRemove:t})])}};e([p({type:t,nonNullable:!0})],y.prototype,"color",void 0),e([p()],y.prototype,"viewVisualizationEnabled",void 0),e([p()],y.prototype,"queryElevationDependencies",null),e([p()],y.prototype,"available",null),e([p()],y.prototype,"_elevationInfo",null),e([p()],y.prototype,"_visibleLayers",null),y=e([c("esri.widgets.ElevationProfile.ElevationProfileLineInput")],y);const d=y;export{d 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/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Color.js";import{handlesGroup as r}from"../../core/handleUtils.js";import{
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Color.js";import{handlesGroup as r}from"../../core/handleUtils.js";import{isNone as i,applySome as o,unwrapOr as n,isSome as s}from"../../core/maybe.js";import{memoize as l}from"../../core/memoize.js";import{watch as c,on as a}from"../../core/reactiveUtils.js";import{union as p}from"../../core/SetUtils.js";import{getMetersPerVerticalUnitForSR as u}from"../../core/unitUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{s as v}from"../../chunks/vec3.js";import{c as y}from"../../chunks/vec4f64.js";import{getReferenceEllipsoid as f}from"../../geometry/projectionEllipsoid.js";import{create as h,fromPoints as _}from"../../geometry/support/ray.js";import{GeometryDescriptor as w}from"../../layers/support/ElevationQuery.js";import{newIntersector as I}from"../../views/3d/webgl-engine/lib/Intersector.js";import{StoreResults as g}from"../../views/3d/webgl-engine/lib/IntersectorInterfaces.js";import{toGraphic as j}from"../../views/3d/webgl-engine/lib/intersectorUtilsConversions.js";import b from"./ElevationProfileLine.js";const x=2e5;let E=class extends b{constructor(e){super(e),this.type="view",this.color=new t("#cf4ccf"),this.viewVisualizationEnabled=!0,this.include=null,this.exclude=null,this.numSamplesForPreview=50,this.numSamplesPerChunk=25,this._getQueryElevationDependencies=l(((e,t,r,i,o,n,l)=>({inputGraphicUid:s(e)?D(e):null,visibleLayers:t,maxIntersectionDistance:r,intersectOptions:i,view:o,stationary:n,spatialReference:l}))),this._vecA=y(),this._vecB=y(),this._ray=h()}get minDemResolution(){const e=this._viewModel?.view;if(i(e)||"3d"!==e.type)return null;const t=e.pointsOfInterest?.focus?.renderLocation;if(!t)return null;return e.state.camera.computeRenderPixelSizeAt(t)*u(e.spatialReference)}get queryElevationDependencies(){return o(this._view,(e=>this._getQueryElevationDependencies(this._viewModel.input,this._visibleLayers,this._maxIntersectionDistance,this._intersectOptions,e,e.stationary,e.spatialReference)))}get _visibleLayers(){const e=this._view,t=o(e,(e=>e.map?.allLayers?.filter((e=>e.visible)).toArray()));return n(t,[])}get _intersectOptions(){const e=this._view;if(i(e))return{};const t=e.externalToInternalIntersectOptions({include:this.include,exclude:this.exclude}),r=e.externalToInternalIntersectOptions({exclude:this._pointCloudLayers});return t.exclude=p(t.exclude,r.exclude),t}get _pointCloudLayers(){const e=this._view;return i(e)?[]:e.allLayerViews.toArray().filter((e=>"point-cloud"===e.layer?.type)).map((e=>e.layer))}get _view(){const e=this._viewModel.view;return s(e)&&"3d"===e.type?e:null}get _maxIntersectionDistance(){const e=this._view;return i(e)||!e.renderCoordsHelper?Number.POSITIVE_INFINITY:f(e.spatialReference).radius/e.renderCoordsHelper.unitInMeters}get _intersector(){const e=this._view;if(i(e))return null;const t=I(e.state.viewingMode),r=t.options;return r.hud=!1,r.invisibleTerrain=!1,r.backfacesTerrain=!1,r.selectionMode=!1,r.store=g.ALL,t}async queryElevation(e,{noDataValue:t,signal:r}){const o=this.queryElevationDependencies;if(i(o))throw new Error("ElevationProfileLineInput: no dependencies");const n=this._intersector;if(i(n))throw new Error("ElevationProfileLineInput: no view");const{intersectOptions:s,view:l,spatialReference:c}=o,a=l.renderCoordsHelper,p=l.sceneIntersectionHelper,u=this._vecA,d=this._vecA,m=this._vecB,y=this._ray,f=await w.fromGeometry(e).project(c,r),h=f.coordinates,I=h.length;for(let i=0;i<I;++i){const e=h[i];v(m,e.x,e.y,e.z??0),a.toRenderCoords(m,c,m),a.setAltitude(u,x,m);const r=_(u,m,y);p.computeIntersection(r,n,s);const l=L(o,n.results.all);l?(l.getIntersectionPoint(d),a.fromRenderCoords(d,d,c),e.z=d[2]):e.z=t}return{geometry:f.export(),noDataValue:t}}attach(e){const t=()=>this._onChange();return r([super.attach(e),c((()=>this.queryElevationDependencies),t),a((()=>e.elevationProvider),"elevation-change",t,{onListenerAdd:t,onListenerRemove:t})])}};function L({view:e,inputGraphicUid:t,maxIntersectionDistance:r},o){for(const n of o){if(n.distanceInRenderSpace>r)continue;const o=j(n,e);if(i(o)||D(o)!==t)return n}return null}function D(e){if(e.layer&&"objectIdField"in e.layer){const t=e.attributes[e.layer.objectIdField];if(t)return`o-${e.layer.id}-${t}`}return`u-${e.uid}`}e([d({type:t,nonNullable:!0})],E.prototype,"color",void 0),e([d()],E.prototype,"viewVisualizationEnabled",void 0),e([d()],E.prototype,"include",void 0),e([d()],E.prototype,"exclude",void 0),e([d({readOnly:!0})],E.prototype,"minDemResolution",null),e([d()],E.prototype,"queryElevationDependencies",null),e([d()],E.prototype,"_visibleLayers",null),e([d()],E.prototype,"_intersectOptions",null),e([d()],E.prototype,"_pointCloudLayers",null),e([d()],E.prototype,"_view",null),e([d()],E.prototype,"_maxIntersectionDistance",null),e([d()],E.prototype,"_intersector",null),E=e([m("esri.widgets.ElevationProfile.ElevationProfileLineView")],E);const C=E;export{C as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../intl.js";import{binaryFindClosest as i}from"../../../core/arrayUtils.js";import{makeHandle as e,handlesGroup as t}from"../../../core/handleUtils.js";import{isNone as o,applySome as n,isSome as a,unwrapOr as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{formatDecimal as l,unitName as d}from"../../../core/unitFormatUtils.js";import{convertUnit as c}from"../../../core/unitUtils.js";import{CHART_CSS as m}from"../css.js";import{getConfig as x,NOT_AVAILABLE as p}from"./constants.js";import{getTranslatedLineTitle as u}from"./intlUtils.js";import{niceScale as g}from"./niceScale.js";import{loadChartsModule as f}from"../../support/chartUtils.js";import{isRTL as h}from"../../support/widgetUtils.js";import{isDarkTheme as b}from"../../../support/themeUtils.js";import{substitute as v}from"../../../intl/substitute.js";import{formatNumber as T}from"../../../intl/number.js";const A="#f8f8f8",C="#a9a9a9",y="#323232",L="line",z="fill",k=15,P=12,S=30,F=.001,w=.5,M=.5,Y=30,X=.02,I=.02,W={sideSpacing:k,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,axisFontSize:9,axisFontWeight:"400",axisGridStroke:"#f4f4f4",axisLabelsFontSize:9,axisLabelsFontWeight:"400",axisLabelsColor:C,axisTooltipFontSize:12,axisTooltipBackgroundColor:y,axisTooltipLabelColor:A,axisTooltipPaddingTop:Math.round(P/4),axisTooltipPaddingBottom:Math.round(P/4),axisTooltipPaddingHorizontal:Math.round(k/4),xAxisMinGridDistance:50,xAxisLabelsSpacing:Math.round(P/2),xAxisMinLabelPosition:.05,xAxisMaxLabelPosition:.9,yAxisMinGridDistance:30,yAxisLabelSpacing:Math.round(k/4),yAxisMinLabelPosition:0,yAxisMaxLabelPosition:.8,seriesTooltipFontSize:12,seriesTooltipBackgroundColor:A,seriesTooltipLabelColor:y,seriesFillLighten:.9,seriesTooltipSpacing:P/2,seriesTooltipPaddingVertical:Math.round(k/4),seriesTooltipPaddingHorizontal:Math.round(k/4),tooltipBorderRadius:0},j={...W,axisGridStroke:y,axisLabelsColor:C,axisTooltipBackgroundColor:y,axisTooltipLabelColor:A,seriesTooltipBackgroundColor:y,seriesTooltipLabelColor:A,seriesFillLighten:-.75},H={minX:void 0,maxX:void 0,minY:void 0,maxY:void 0};async function O(i){const e=await f(),{am4core:n,am4charts:a}=e;r(i.abortOptions);const{options:s}=n;s.minPolylineStep=w,s.autoSetClassName=!0,s.animationsEnabled=!1;const l=b(),d=l?j:W;l&&n.useTheme(e.am4themes_dark);const c=n.create(i.container,a.XYChart);c.arrangeTooltips=!1,c.preloader.disabled=!0,c.zoomOutButton.disabled=!0;const m=h(i.container);c.rtl=m,c.padding(d.paddingTop,m?d.paddingLeft:d.paddingRight,d.paddingBottom,m?d.paddingRight:d.paddingLeft);const x=c.plotContainer.background;x.strokeWidth=0,x.strokeOpacity=0,x.stroke=null;const p=c.xAxes.push(new a.ValueAxis),u=c.yAxes.push(new a.ValueAxis),g={params:i,amCharts4Index:e,amChart:c,xAxis:p,yAxis:u,series:new Map,data:null,messages:null,theme:d,zooming:!1,pointerIsOver:!1};c.cursor=U(g),B(g),D(g),E(g);const v=[Q(g,i.onRangeChange),ei(g,i.onCursorPositionChange),ii(g)];let T=null,A=!1;const C=()=>{o(T)||("undefined"!=typeof window&&"cancelIdleCallback"in window?window.cancelIdleCallback(T):clearTimeout(T),T=null)};return{...g,destroy(){A=!0,C(),t(v).remove(),c.dispose()},update(i){if(i.data===g.data&&i.messages===g.messages)return;if(C(),A)return;const e=()=>{A||(T=null,G(g,i))};T="undefined"!=typeof window&&"requestIdleCallback"in window?window.requestIdleCallback(e,{timeout:Y}):setTimeout(e,Y)},zoomOut(){A||(g.yAxis.zoom({start:0,end:1},!1,!0),g.xAxis.zoom({start:0,end:1},!1,!0))}}}function U(i){const e=new i.amCharts4Index.am4charts.XYCursor;return e.trackable=!0,e.lineY.disabled=!0,e.behavior="zoomXY",e}function B(i){const e=i.theme,t=i.amChart.tooltip,{am4core:o}=i.amCharts4Index;t.id="series-tooltip",t.fitPointerToBounds=!0,t.pointerOrientation="vertical",t.zIndex=-1,t.getFillFromObject=!1,t.label.fontSize=e.seriesTooltipFontSize,t.label.fill=o.color(e.seriesTooltipLabelColor),t.label.padding(e.seriesTooltipPaddingVertical,e.seriesTooltipPaddingHorizontal,e.seriesTooltipPaddingVertical,e.seriesTooltipPaddingHorizontal),t.background.cornerRadius=e.tooltipBorderRadius,t.background.stroke=null,t.background.fill=o.color(e.seriesTooltipBackgroundColor),t.background.padding(0,0,0,0),t.adapter.add("dy",(()=>e.seriesTooltipSpacing*(t.background.pointerY<=0?1:-1))),h(i.params.container)&&(t.label.textAlign="middle")}function D(i){const{xAxis:e,theme:t}=i,{am4core:o}=i.amCharts4Index;e.numberFormatter=ri(i,"distance"),e.strictMinMax=!0,e.cursorTooltipEnabled=!1,e.title.visible=!1;const n=e.renderer;n.line.visible=!1,n.minGridDistance=t.xAxisMinGridDistance,n.minLabelPosition=t.xAxisMinLabelPosition,n.maxLabelPosition=t.xAxisMaxLabelPosition,n.fontWeight=t.axisFontWeight,n.fontSize=t.axisFontSize,n.baseGrid.disabled=!0;const a=n.labels.template;a.fontSize=t.axisLabelsFontSize,a.fontWeight=t.axisLabelsFontWeight,a.fill=o.color(t.axisLabelsColor),a.paddingTop=t.xAxisLabelsSpacing,a.horizontalCenter="left",a.paddingLeft=0;const s=e.tooltip;s.id="axis-tooltip",s.background.fill=o.color(t.axisTooltipBackgroundColor),s.background.stroke=null,s.background.padding(0,0,0,0),s.label.fontSize=t.axisTooltipFontSize,s.label.fill=o.color(t.axisTooltipLabelColor),s.label.padding(t.axisTooltipPaddingTop,t.axisTooltipPaddingHorizontal,t.axisTooltipPaddingBottom,t.axisTooltipPaddingHorizontal);const r=n.grid.template;r.strokeOpacity=1,r.stroke=o.color(t.axisGridStroke)}function E(i){const{yAxis:e,theme:t}=i,{am4core:o}=i.amCharts4Index;e.numberFormatter=ri(i,"elevation"),e.title.visible=!1,e.cursorTooltipEnabled=!1,e.strictMinMax=!0,e.baseValue=x().noDataValue;const n=e.renderer;n.inside=!0,n.line.opacity=0,n.line.visible=!1,n.minGridDistance=t.yAxisMinGridDistance,n.minLabelPosition=t.yAxisMinLabelPosition,n.maxLabelPosition=t.yAxisMaxLabelPosition,n.fontWeight=t.axisFontWeight,n.fontSize=t.axisFontSize,n.baseGrid.disabled=!0;const a=n.labels.template;a.fontSize=t.axisLabelsFontSize,a.fontWeight=t.axisLabelsFontWeight,a.fill=o.color(t.axisLabelsColor),a.verticalCenter="bottom",a.paddingLeft=t.yAxisLabelSpacing,a.paddingBottom=0;const s=n.grid.template;s.strokeOpacity=1,s.stroke=o.color(t.axisGridStroke),h(i.params.container)&&(n.opposite=!0,a.textAlign="middle",a.paddingLeft=0,a.paddingRight=t.yAxisLabelSpacing)}function G(i,{data:e,messages:t}){const{htmlContainer:o}=i.amChart;if(!o)return;const s=a(e)&&e.refined;i.amChart.cursor.disabled=!s,o.classList.toggle(m.cursorEnabled,s);const r=i.data!==e,l=n(i.data,(i=>i.effectiveUnits))!==n(e,(i=>i.effectiveUnits));i.data=e,i.messages=t,r&&(R(i),q(i)),l&&(i.yAxis.invalidateLabels(),i.xAxis.invalidateLabels()),ti(i)}function R(i){const{xAxis:e,yAxis:t}=i,{minX:o,maxX:n,minY:a,maxY:s}=V({data:i.data,pixelWidth:e.pixelWidth,pixelHeight:t.pixelHeight});e.min=o,e.max=n,t.min=a,t.max=s}function V({data:i,pixelWidth:e,pixelHeight:t}){if(o(i))return H;const a=i.statistics,s=0,r=n(a,(i=>i.maxDistance));let l=n(a,(i=>i.minElevation)),d=n(a,(i=>i.maxElevation));if(o(r)||o(l)||o(d))return H;const m=Math.max(r-s,F);let p=Math.max(d-l,F);const u=i.effectiveUnits;if(i.dynamicElevationRange){const i=c(m,u.distance,u.elevation);p=Math.max(p,i/x().maxChartRatio)}return l-=I*p,d=l+p+X*p,[l,d]=g(l,d,10),p=d-l,i.uniformScaling?$({data:i,bounds:{minX:s,maxX:r,minY:l,maxY:d},pixelWidth:e,pixelHeight:t,centered:!0}):{minX:s,maxX:s+m,minY:l,maxY:l+p}}function $({data:i,bounds:e,pixelWidth:t,pixelHeight:n,centered:a}){if(o(i))return e;let{minX:s,maxX:r,minY:l,maxY:d}=e;const m=r-s,x=d-l,p=i.effectiveUnits,u=c(x,p.elevation,p.distance)/n/(m/t);return u>=1?[s,r]=Z([s,r],u,a):[l,d]=Z([l,d],1/u,a),{minX:s,maxX:r,minY:l,maxY:d}}function Z([i,e],t,o){const n=(e-i)*t;if(o){const t=(i+e)/2-n/2;return[t,t+n]}return[i,i+n]}function q(i){const{amChart:e,data:t}=i;if(o(t)||0===t.lines.length)return void e.series.clear();const a=new Map,s=new Set(e.series.values),r=t.lines.length;for(let o=0;o<r;o++){const l=t.lines[o];let d=i.series.get(l.id);d?(n(d.fill,(i=>s.delete(i))),s.delete(d.line)):(d=J(i,l),n(d.fill,(i=>e.series.push(i))),e.series.push(d.line)),a.set(d.id,d);const c=r-o-1;n(d.fill,(i=>i.zIndex=c)),d.line.zIndex=r+c,N(i,d,l)}i.series=a;for(const o of s)e.series.removeValue(o)}function N(i,{line:e,fill:t},o){const{theme:r}=i,{am4core:l}=i.amCharts4Index,{r:d,g:c,b:m,a:x}=o.color,p=l.color({r:d,g:c,b:m,a:x}),u=s(o.samples,new Array),g=u.length>0;e.stroke=p,e.visible=g,n(t,(i=>{i.visible=g,i.fill=p.lighten(r.seriesFillLighten)}));const f=u.length,h=e.data;if(h.length===f){let i=!1;for(let e=0;e<f;++e){const t=h[e],o=u[e];i=i||a(t.elevation)!==a(o.elevation),_(t,o)}i?(e.invalidateData(),n(t,(i=>i.invalidateData()))):(e.invalidateRawData(),n(t,(i=>i.invalidateRawData())))}else e.data=u,n(t,(i=>i.data=u))}function _(i,e){i.x=e.x,i.y=e.y,i.z=e.z,i.distance=e.distance,i.elevation=e.elevation}function J(i,e){const{id:t}=e,o=K(i,`${L}-${t}`);o.strokeWidth=e.chartStrokeWidth,o.dy=e.chartStrokeOffsetY;let n=null;return e.chartFillEnabled&&(n=K(i,`${z}-${t}`),n.fillOpacity=1),{id:t,line:o,fill:n}}function K(i,e){const t=new i.amCharts4Index.am4charts.LineSeries;t.id=e,t.showOnInit=!1,t.simplifiedProcessing=!0,t.minDistance=M,t.excludeFromTotal=!0,t.clickable=!1,t.contextMenuDisabled=!0,t.cursorHoverEnabled=!1,t.cursorTooltipEnabled=!1,t.connect=!1,t.fill=null,t.stroke=null;const o="distance";t.dataFields.valueX=o;const n="elevation";return t.dataFields.valueY=n,t}function Q(i,t){const{amChart:n,xAxis:a,yAxis:s}=i;let r=!1;const l=()=>{const{data:e}=i;if(!r||o(e)||!e.uniformScaling)return;r=!1;const{minX:t,maxX:l,minY:d,maxY:c}=$({data:i.data,bounds:{minX:a.minZoomed,maxX:a.maxZoomed,minY:s.minZoomed,maxY:s.maxZoomed},pixelWidth:a.pixelWidth,pixelHeight:s.pixelHeight,centered:!0});a.zoomToValues(t,l,!0),s.zoomToValues(d,c,!0),n.validate(),ti(i)},d=()=>{t(i.xAxis.zoomFactor,i.yAxis.zoomFactor)},c=e=>{i.zooming=e,ti(i)},m=[n.events.on("down",(()=>c(!0))),n.events.on("up",(()=>c(!1))),n.cursor.events.on("zoomended",(()=>{r=!0})),a.events.on("startendchanged",l),s.events.on("startendchanged",l),a.events.on("rangechangeended",d),s.events.on("rangechangeended",d)];return e((()=>{m.forEach((i=>i.dispose()))}))}function ii({xAxis:i,yAxis:t}){const o=i=>()=>{i.renderer.grid.each((i=>{i.visible="none"!==i.dataItem.label.dom.getAttribute("display")}))},n=[i.events.on("rangechangeended",o(i)),i.events.on("validated",o(i)),t.events.on("rangechangeended",o(t)),t.events.on("validated",o(t))];return e((()=>{n.forEach((i=>i.dispose()))}))}function ei(i,t){const{amChart:o,xAxis:n,yAxis:a}=i,{cursor:s,events:r}=o,l=e=>{i.pointerIsOver=e,ti(i)},d=()=>{l(!1),t(null,null)},c=[s.events.on("cursorpositionchanged",(()=>{if(!i.pointerIsOver)return;ti(i);const e=n.toAxisPosition(s.xPosition),o=a.toAxisPosition(s.yPosition);t(e,o)})),r.on("over",(()=>l(!0))),r.on("out",d),r.on("blur",d)];return e((()=>{c.forEach((i=>i.dispose()))}))}function ti(i){const{amChart:e,xAxis:t,data:n,theme:s,zooming:r,pointerIsOver:l}=i;if(i.amChart.tooltip.hide(),i.xAxis.hideTooltip(),!l)return;if(r)return;if(o(n)||!n.refined)return;const d=oi(i);if(a(d)){const{cursor:o,tooltip:n}=e;o.show(0),o.validate(),n.text=d.text,n.show(0),n.validate();const a=d.y-n.contentHeight-s.seriesTooltipSpacing;n.pointerOrientation=a<S?"up":"down",n.pointTo(d,!0),n.validate();const r=t.tooltip;r.text=si(i),r.show(0),r.validate()}}function oi(i){const{amChart:e,yAxis:t,data:a}=i;if(o(a))return null;const s=a.lines.map((e=>({line:e,y:n(li(i,e),(i=>i.elevation))}))).sort(ni),r=s.length?s[0].y:null;if(o(r))return null;const l=e.cursor,d=t.measuredHeight,c=d+e.pixelPaddingTop;return{text:s.map((({y:e,line:t})=>ai(i,t,e))).join("\n"),x:l.point.x+l.parent.pixelX+e.pixelPaddingLeft,y:c-t.valueToPosition(r)*d}}function ni({y:i},{y:e}){return o(i)?1:o(e)?-1:e-i}function ai(i,e,t){const{data:n,messages:s}=i;if(o(n)||o(s))return"";const r=x().formatPrecision,d=v(s.chartTooltip,{name:u(e,s),elevation:a(t)?l(s,t,n.effectiveUnits.elevation,r):p});return`[${e.color.toHex()}]●[/] ${d}`}function si(i){const{data:e,messages:t}=i;if(o(e)||o(t))return"";const n=e.lines[0],s=n?li(i,n):null,r=x().formatPrecision;return a(s)?l(t,s.distance,e.effectiveUnits.distance,r):"-"}function ri(i,e){const t=i.xAxis.numberFormatter.clone();return t.format=(t,n,a)=>{const{messages:s,data:r}=i;if(o(s)||o(r)||"string"==typeof t)return"";return`${T(t,{maximumFractionDigits:a})} ${d(s,r.effectiveUnits[e],"abbr")}`},t}function li({amChart:e,xAxis:t},o){const n=s(o.samples,[]);if(0===n.length)return null;const a=t.toAxisPosition(e.cursor.xPosition),r=t.positionToValue(a);return i(n,r,(i=>i.distance))}export{O as createChart,V as getAdjustedBounds};
|
|
5
|
+
import"../../../intl.js";import{binaryFindClosest as i}from"../../../core/arrayUtils.js";import{handlesGroup as e,makeHandle as t}from"../../../core/handleUtils.js";import{isNone as o,applySome as n,isSome as a,unwrapOr as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{formatDecimal as l,unitName as d}from"../../../core/unitFormatUtils.js";import{convertUnit as c}from"../../../core/unitUtils.js";import{CHART_CSS as m}from"../css.js";import{getConfig as x,NOT_AVAILABLE as p}from"./constants.js";import{getTranslatedLineTitle as u}from"./intlUtils.js";import{niceScale as g}from"./niceScale.js";import{loadChartsModule as f}from"../../support/chartUtils.js";import{isRTL as h}from"../../support/widgetUtils.js";import{isDarkTheme as b}from"../../../support/themeUtils.js";import{substitute as v}from"../../../intl/substitute.js";import{formatNumber as T}from"../../../intl/number.js";const A="#f8f8f8",C="#a9a9a9",y="#323232",L="line",z="fill",k=15,P=12,S=30,F=.001,w=.5,M=.5,Y=30,X=.02,I=.02,W={sideSpacing:k,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,axisFontSize:9,axisFontWeight:"400",axisGridStroke:"#f4f4f4",axisLabelsFontSize:9,axisLabelsFontWeight:"400",axisLabelsColor:C,axisTooltipFontSize:12,axisTooltipBackgroundColor:y,axisTooltipLabelColor:A,axisTooltipPaddingTop:Math.round(P/4),axisTooltipPaddingBottom:Math.round(P/4),axisTooltipPaddingHorizontal:Math.round(k/4),xAxisMinGridDistance:50,xAxisLabelsSpacing:Math.round(P/2),xAxisMinLabelPosition:.05,xAxisMaxLabelPosition:.9,yAxisMinGridDistance:30,yAxisLabelSpacing:Math.round(k/4),yAxisMinLabelPosition:0,yAxisMaxLabelPosition:.8,seriesTooltipFontSize:12,seriesTooltipBackgroundColor:A,seriesTooltipLabelColor:y,seriesFillLighten:.9,seriesTooltipSpacing:P/2,seriesTooltipPaddingVertical:Math.round(k/4),seriesTooltipPaddingHorizontal:Math.round(k/4),tooltipBorderRadius:0},j={...W,axisGridStroke:y,axisLabelsColor:C,axisTooltipBackgroundColor:y,axisTooltipLabelColor:A,seriesTooltipBackgroundColor:y,seriesTooltipLabelColor:A,seriesFillLighten:-.75},H={minX:void 0,maxX:void 0,minY:void 0,maxY:void 0};async function O(i){const t=await f(),{am4core:n,am4charts:a}=t;r(i.abortOptions);const{options:s}=n;s.minPolylineStep=w,s.autoSetClassName=!0,s.animationsEnabled=!1;const l=b(),d=l?j:W;l&&n.useTheme(t.am4themes_dark);const c=n.create(i.container,a.XYChart);c.arrangeTooltips=!1,c.preloader.disabled=!0,c.zoomOutButton.disabled=!0;const m=h(i.container);c.rtl=m,c.padding(d.paddingTop,m?d.paddingLeft:d.paddingRight,d.paddingBottom,m?d.paddingRight:d.paddingLeft);const x=c.plotContainer.background;x.strokeWidth=0,x.strokeOpacity=0,x.stroke=null;const p=c.xAxes.push(new a.ValueAxis),u=c.yAxes.push(new a.ValueAxis),g={params:i,amCharts4Index:t,amChart:c,xAxis:p,yAxis:u,series:new Map,data:null,messages:null,theme:d,zooming:!1,pointerIsOver:!1};c.cursor=U(g),B(g),D(g),E(g);const v=[Q(g,i.onRangeChange),ei(g,i.onCursorPositionChange),ii(g)];let T=null,A=!1;const C=()=>{o(T)||("undefined"!=typeof window&&"cancelIdleCallback"in window?window.cancelIdleCallback(T):clearTimeout(T),T=null)};return{...g,destroy(){A=!0,C(),e(v).remove(),c.dispose()},update(i){if(i.data===g.data&&i.messages===g.messages)return;if(C(),A)return;const e=()=>{A||(T=null,G(g,i))};T="undefined"!=typeof window&&"requestIdleCallback"in window?window.requestIdleCallback(e,{timeout:Y}):setTimeout(e,Y)},zoomOut(){A||(g.yAxis.zoom({start:0,end:1},!1,!0),g.xAxis.zoom({start:0,end:1},!1,!0))}}}function U(i){const e=new i.amCharts4Index.am4charts.XYCursor;return e.trackable=!0,e.lineY.disabled=!0,e.behavior="zoomXY",e}function B(i){const e=i.theme,t=i.amChart.tooltip,{am4core:o}=i.amCharts4Index;t.id="series-tooltip",t.fitPointerToBounds=!0,t.pointerOrientation="vertical",t.zIndex=-1,t.getFillFromObject=!1,t.label.fontSize=e.seriesTooltipFontSize,t.label.fill=o.color(e.seriesTooltipLabelColor),t.label.padding(e.seriesTooltipPaddingVertical,e.seriesTooltipPaddingHorizontal,e.seriesTooltipPaddingVertical,e.seriesTooltipPaddingHorizontal),t.background.cornerRadius=e.tooltipBorderRadius,t.background.stroke=null,t.background.fill=o.color(e.seriesTooltipBackgroundColor),t.background.padding(0,0,0,0),t.adapter.add("dy",(()=>e.seriesTooltipSpacing*(t.background.pointerY<=0?1:-1))),h(i.params.container)&&(t.label.textAlign="middle")}function D(i){const{xAxis:e,theme:t}=i,{am4core:o}=i.amCharts4Index;e.numberFormatter=ri(i,"distance"),e.strictMinMax=!0,e.cursorTooltipEnabled=!1,e.title.visible=!1;const n=e.renderer;n.line.visible=!1,n.minGridDistance=t.xAxisMinGridDistance,n.minLabelPosition=t.xAxisMinLabelPosition,n.maxLabelPosition=t.xAxisMaxLabelPosition,n.fontWeight=t.axisFontWeight,n.fontSize=t.axisFontSize,n.baseGrid.disabled=!0;const a=n.labels.template;a.fontSize=t.axisLabelsFontSize,a.fontWeight=t.axisLabelsFontWeight,a.fill=o.color(t.axisLabelsColor),a.paddingTop=t.xAxisLabelsSpacing,a.horizontalCenter="left",a.paddingLeft=0;const s=e.tooltip;s.id="axis-tooltip",s.background.fill=o.color(t.axisTooltipBackgroundColor),s.background.stroke=null,s.background.padding(0,0,0,0),s.label.fontSize=t.axisTooltipFontSize,s.label.fill=o.color(t.axisTooltipLabelColor),s.label.padding(t.axisTooltipPaddingTop,t.axisTooltipPaddingHorizontal,t.axisTooltipPaddingBottom,t.axisTooltipPaddingHorizontal);const r=n.grid.template;r.strokeOpacity=1,r.stroke=o.color(t.axisGridStroke)}function E(i){const{yAxis:e,theme:t}=i,{am4core:o}=i.amCharts4Index;e.numberFormatter=ri(i,"elevation"),e.title.visible=!1,e.cursorTooltipEnabled=!1,e.strictMinMax=!0,e.baseValue=x().noDataValue;const n=e.renderer;n.inside=!0,n.line.opacity=0,n.line.visible=!1,n.minGridDistance=t.yAxisMinGridDistance,n.minLabelPosition=t.yAxisMinLabelPosition,n.maxLabelPosition=t.yAxisMaxLabelPosition,n.fontWeight=t.axisFontWeight,n.fontSize=t.axisFontSize,n.baseGrid.disabled=!0;const a=n.labels.template;a.fontSize=t.axisLabelsFontSize,a.fontWeight=t.axisLabelsFontWeight,a.fill=o.color(t.axisLabelsColor),a.verticalCenter="bottom",a.paddingLeft=t.yAxisLabelSpacing,a.paddingBottom=0;const s=n.grid.template;s.strokeOpacity=1,s.stroke=o.color(t.axisGridStroke),h(i.params.container)&&(n.opposite=!0,a.textAlign="middle",a.paddingLeft=0,a.paddingRight=t.yAxisLabelSpacing)}function G(i,{data:e,messages:t}){const{htmlContainer:o}=i.amChart;if(!o)return;const s=a(e)&&e.refined;i.amChart.cursor.disabled=!s,o.classList.toggle(m.cursorEnabled,s);const r=i.data!==e,l=n(i.data,(i=>i.effectiveUnits))!==n(e,(i=>i.effectiveUnits));i.data=e,i.messages=t,r&&(R(i),q(i)),l&&(i.yAxis.invalidateLabels(),i.xAxis.invalidateLabels()),ti(i)}function R(i){const{xAxis:e,yAxis:t}=i,{minX:o,maxX:n,minY:a,maxY:s}=V({data:i.data,pixelWidth:e.pixelWidth,pixelHeight:t.pixelHeight});e.min=o,e.max=n,t.min=a,t.max=s}function V({data:i,pixelWidth:e,pixelHeight:t}){if(o(i))return H;const a=i.statistics,s=0,r=n(a,(i=>i.maxDistance));let l=n(a,(i=>i.minElevation)),d=n(a,(i=>i.maxElevation));if(o(r)||o(l)||o(d))return H;const m=Math.max(r-s,F);let p=Math.max(d-l,F);const u=i.effectiveUnits;if(i.dynamicElevationRange){const i=c(m,u.distance,u.elevation);p=Math.max(p,i/x().maxChartRatio)}return l-=I*p,d=l+p+X*p,[l,d]=g(l,d,10),p=d-l,i.uniformScaling?$({data:i,bounds:{minX:s,maxX:r,minY:l,maxY:d},pixelWidth:e,pixelHeight:t,centered:!0}):{minX:s,maxX:s+m,minY:l,maxY:l+p}}function $({data:i,bounds:e,pixelWidth:t,pixelHeight:n,centered:a}){if(o(i))return e;let{minX:s,maxX:r,minY:l,maxY:d}=e;const m=r-s,x=d-l,p=i.effectiveUnits,u=c(x,p.elevation,p.distance)/n/(m/t);return u>=1?[s,r]=Z([s,r],u,a):[l,d]=Z([l,d],1/u,a),{minX:s,maxX:r,minY:l,maxY:d}}function Z([i,e],t,o){const n=(e-i)*t;if(o){const t=(i+e)/2-n/2;return[t,t+n]}return[i,i+n]}function q(i){const{amChart:e,data:t}=i;if(o(t)||0===t.lines.length)return void e.series.clear();const a=new Map,s=new Set(e.series.values),r=t.lines.length;for(let o=0;o<r;o++){const l=t.lines[o];let d=i.series.get(l.id);d?(n(d.fill,(i=>s.delete(i))),s.delete(d.line)):(d=J(i,l),n(d.fill,(i=>e.series.push(i))),e.series.push(d.line)),a.set(d.id,d);const c=r-o-1;n(d.fill,(i=>i.zIndex=c)),d.line.zIndex=r+c,N(i,d,l)}i.series=a;for(const o of s)e.series.removeValue(o)}function N(i,{line:e,fill:t},o){const{theme:r}=i,{am4core:l}=i.amCharts4Index,{r:d,g:c,b:m,a:x}=o.color,p=l.color({r:d,g:c,b:m,a:x}),u=s(o.samples,new Array),g=u.length>0;e.stroke=p,e.visible=g,n(t,(i=>{i.visible=g,i.fill=p.lighten(r.seriesFillLighten)}));const f=u.length,h=e.data;if(h.length===f){let i=!1;for(let e=0;e<f;++e){const t=h[e],o=u[e];i=i||a(t.elevation)!==a(o.elevation),_(t,o)}i?(e.invalidateData(),n(t,(i=>i.invalidateData()))):(e.invalidateRawData(),n(t,(i=>i.invalidateRawData())))}else e.data=u,n(t,(i=>i.data=u))}function _(i,e){i.x=e.x,i.y=e.y,i.z=e.z,i.distance=e.distance,i.elevation=e.elevation}function J(i,e){const{id:t}=e,o=K(i,`${L}-${t}`);o.strokeWidth=e.chartStrokeWidth,o.dy=e.chartStrokeOffsetY;let n=null;return e.chartFillEnabled&&(n=K(i,`${z}-${t}`),n.fillOpacity=1),{id:t,line:o,fill:n}}function K(i,e){const t=new i.amCharts4Index.am4charts.LineSeries;t.id=e,t.showOnInit=!1,t.simplifiedProcessing=!0,t.minDistance=M,t.excludeFromTotal=!0,t.clickable=!1,t.contextMenuDisabled=!0,t.cursorHoverEnabled=!1,t.cursorTooltipEnabled=!1,t.connect=!1,t.fill=null,t.stroke=null;const o="distance";t.dataFields.valueX=o;const n="elevation";return t.dataFields.valueY=n,t}function Q(i,e){const{amChart:n,xAxis:a,yAxis:s}=i;let r=!1;const l=()=>{const{data:e}=i;if(!r||o(e)||!e.uniformScaling)return;r=!1;const{minX:t,maxX:l,minY:d,maxY:c}=$({data:i.data,bounds:{minX:a.minZoomed,maxX:a.maxZoomed,minY:s.minZoomed,maxY:s.maxZoomed},pixelWidth:a.pixelWidth,pixelHeight:s.pixelHeight,centered:!0});a.zoomToValues(t,l,!0),s.zoomToValues(d,c,!0),n.validate(),ti(i)},d=()=>{e(i.xAxis.zoomFactor,i.yAxis.zoomFactor)},c=e=>{i.zooming=e,ti(i)},m=[n.events.on("down",(()=>c(!0))),n.events.on("up",(()=>c(!1))),n.cursor.events.on("zoomended",(()=>{r=!0})),a.events.on("startendchanged",l),s.events.on("startendchanged",l),a.events.on("rangechangeended",d),s.events.on("rangechangeended",d)];return t((()=>{m.forEach((i=>i.dispose()))}))}function ii({xAxis:i,yAxis:e}){const o=i=>()=>{i.renderer.grid.each((i=>{i.visible="none"!==i.dataItem.label.dom.getAttribute("display")}))},n=[i.events.on("rangechangeended",o(i)),i.events.on("validated",o(i)),e.events.on("rangechangeended",o(e)),e.events.on("validated",o(e))];return t((()=>{n.forEach((i=>i.dispose()))}))}function ei(i,e){const{amChart:o,xAxis:n,yAxis:a}=i,{cursor:s,events:r}=o,l=e=>{i.pointerIsOver=e,ti(i)},d=()=>{l(!1),e(null,null)},c=[s.events.on("cursorpositionchanged",(()=>{if(!i.pointerIsOver)return;ti(i);const t=n.toAxisPosition(s.xPosition),o=a.toAxisPosition(s.yPosition);e(t,o)})),r.on("over",(()=>l(!0))),r.on("out",d),r.on("blur",d)];return t((()=>{c.forEach((i=>i.dispose()))}))}function ti(i){const{amChart:e,xAxis:t,data:n,theme:s,zooming:r,pointerIsOver:l}=i;if(i.amChart.tooltip.hide(),i.xAxis.hideTooltip(),!l)return;if(r)return;if(o(n)||!n.refined)return;const d=oi(i);if(a(d)){const{cursor:o,tooltip:n}=e;o.show(0),o.validate(),n.text=d.text,n.show(0),n.validate();const a=d.y-n.contentHeight-s.seriesTooltipSpacing;n.pointerOrientation=a<S?"up":"down",n.pointTo(d,!0),n.validate();const r=t.tooltip;r.text=si(i),r.show(0),r.validate()}}function oi(i){const{amChart:e,yAxis:t,data:a}=i;if(o(a))return null;const s=a.lines.map((e=>({line:e,y:n(li(i,e),(i=>i.elevation))}))).sort(ni),r=s.length?s[0].y:null;if(o(r))return null;const l=e.cursor,d=t.measuredHeight,c=d+e.pixelPaddingTop;return{text:s.map((({y:e,line:t})=>ai(i,t,e))).join("\n"),x:l.point.x+l.parent.pixelX+e.pixelPaddingLeft,y:c-t.valueToPosition(r)*d}}function ni({y:i},{y:e}){return o(i)?1:o(e)?-1:e-i}function ai(i,e,t){const{data:n,messages:s}=i;if(o(n)||o(s))return"";const r=x().formatPrecision,d=v(s.chartTooltip,{name:u(e,s),elevation:a(t)?l(s,t,n.effectiveUnits.elevation,r):p});return`[${e.color.toHex()}]●[/] ${d}`}function si(i){const{data:e,messages:t}=i;if(o(e)||o(t))return"";const n=e.lines[0],s=n?li(i,n):null,r=x().formatPrecision;return a(s)?l(t,s.distance,e.effectiveUnits.distance,r):"-"}function ri(i,e){const t=i.xAxis.numberFormatter.clone();return t.format=(t,n,a)=>{const{messages:s,data:r}=i;if(o(s)||o(r)||"string"==typeof t)return"";return`${T(t,{maximumFractionDigits:a})} ${d(s,r.effectiveUnits[e],"abbr")}`},t}function li({amChart:e,xAxis:t},o){const n=s(o.samples,[]);if(0===n.length)return null;const a=t.toAxisPosition(e.cursor.xPosition),r=t.positionToValue(a);return i(n,r,(i=>i.distance))}export{O as createChart,V as getAdjustedBounds};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{lerp as e}from"../../../core/mathUtils.js";import{isNone as t,unwrapOr as n,isSome as r}from"../../../core/maybe.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as o}from"../../../core/unitUtils.js";import{d as a,l as i}from"../../../chunks/vec2.js";import{h as c}from"../../../chunks/vec3.js";import u from"../../../geometry/Polyline.js";import{initializeProjection as f,project as l}from"../../../geometry/projection.js";import h from"../../../geometry/SpatialReference.js";import{
|
|
5
|
+
import{lerp as e}from"../../../core/mathUtils.js";import{isNone as t,unwrapOr as n,isSome as r}from"../../../core/maybe.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as o}from"../../../core/unitUtils.js";import{d as a,l as i}from"../../../chunks/vec2.js";import{h as c}from"../../../chunks/vec3.js";import u from"../../../geometry/Polyline.js";import{initializeProjection as f,project as l}from"../../../geometry/projection.js";import h from"../../../geometry/SpatialReference.js";import{geodesicLengths as p,isSupported as m,inverseGeodeticSolver as d,directGeodeticSolver as g}from"../../../geometry/support/geodesicUtils.js";import{ProfileGenerationError as y,ProfileGenerationErrorCause as w}from"./ProfileGenerationError.js";async function R(e,t,n,r,a,i,c){let u,m,d;const g=e.spatialReference,R=g.isGeographic||g.isWebMercator,P=await import("../../../geometry/geometryEngineAsync.js");s(c);let Z=0;R||(Z=await P.planarLength(e,"meters"),s(c));const M=1/o(r);if(R||Z>=a.geodesicDistanceThreshold){await f([{source:g,dest:r},{source:g,dest:h.WGS84}],c);const s=D(e);u=p([s],"meters")[0];const o=j(u,a);if(q(e,u,o)>i)throw new y(w.TooComplex);const R=v(s,t,n);({densifiedPath:m,distances:d}=G(R,o,M)),m=l(m,r)}else{await f([{source:g,dest:r}],c),u=Z;const o=j(u,a);if(q(e,u,o)>i)throw new y(w.TooComplex);const h=v(e,t,n);({densifiedPath:m,distances:d}=z(h,o,M)),s(c),m=l(m,r)}return{densifiedPath:m,pathLength:u*M,distances:d}}function j(e,t){const n=e/t.densificationMaxSamples;return Math.max(t.samplingDistance,n)}function v(e,r,s){if(t(r))return M(e);const o=e.spatialReference,a=r.mode,i=n(r.offset,0);let c=null;switch(s.type){case"2d":c=P(e,a,i);break;case"3d":c=Z(e,a,i,s)}return t(c)?M(e):new u({hasZ:!0,hasM:!1,spatialReference:o,paths:x(e.paths,c)})}function P({hasZ:e},t,n){return"absolute-height"===t?e?([e,t,r])=>[e,t,r+n]:([e,t])=>[e,t,n]:null}function Z({spatialReference:e,hasZ:t},r,s,{elevationProvider:o}){const a=(t,r,s,a)=>n(o?.getElevation(t,r,s,e,a),0);switch(r){case"on-the-ground":return([e,t])=>[e,t,a(e,t,0,"ground")];case"absolute-height":return t?([e,t,n])=>[e,t,n+s]:([e,t])=>[e,t,s];case"relative-to-ground":return t?([e,t,n])=>[e,t,n+a(e,t,n,"ground")+s]:([e,t])=>[e,t,a(e,t,0,"ground")+s];case"relative-to-scene":return t?([e,t,n])=>[e,t,n+a(e,t,n,"scene")+s]:([e,t])=>[e,t,a(e,t,0,"scene")+s];default:return null}}function M(e){return e.hasZ?new u({hasZ:!1,hasM:!1,spatialReference:e.spatialReference,paths:x(e.paths,(([e,t])=>[e,t]))}):e}function x(e,t){const n=e.length,r=new Array(n);for(let s=0;s<n;++s){const n=e[s],o=n.length,a=new Array(n.length);r[s]=a;for(let e=0;e<o;++e)a[e]=t(n[e])}return r}function A(e){return S(e)&&e.paths.length>0&&e.paths.every((e=>e.length>=2))}function S(e){return r(e)&&"polyline"===e.type}function b(e,t,n,r,s){const{spatialReference:a,hasZ:i}=e,c={from:null,to:null,distance:0,azimuth:0,reverseAzimuth:0,spatialReference:a,metersPerSR:o(a)},f=[],l=[];let h=0;for(let o=0;o<e.paths.length;++o){const a=e.paths[o],i=new Array,u=new Array;let p=0;for(let e=1;e<a.length;++e){const o=a[e-1],f=a[e],l=r(c,o,f);let m;for(m=p;m<l.distance;m+=t)i.push(s(l,m)),u.push((h+m)*n);p=m-l.distance,h+=l.distance,i.push(f),u.push(h*n)}f[o]=i,l[o]=u}return{densifiedPath:new u({spatialReference:a,hasZ:i,paths:f}),distances:l}}function z(e,t,n){const{hasZ:r}=e;return b(e,t,n,k,r?C:W)}function G(e,t,n){const{hasZ:r}=e;return b(e,t,n,U,r?T:E)}function U(e,t,n){return e.distance=0,d(e,t,n,e.spatialReference),e.from=t,e.to=n,e}function k(e,t,n){return e.from=t,e.to=n,e.distance=a(n,t)*e.metersPerSR,e}function E({from:e,azimuth:t,spatialReference:n},r){return g([0,0],e,t,r,n)}function T({from:t,to:n,azimuth:r,distance:s,spatialReference:o},a){const i=a/s,c=[0,0,e(t[2],n[2],i)];return g(c,t,r,a,o),c}function W({from:e,to:t,distance:n},r){return i([0,0],e,t,r/n)}function C({from:e,to:t,distance:n},r){return c([0,0,0],e,t,r/n)}function D(e){return m(e.spatialReference)?e:l(e,h.WGS84)}function L(e){return e.paths.reduce(((e,t)=>e+t.length),0)}function q(e,t,n){return L(e)+Math.floor(t/n)+Math.max(0,e.paths.reduce((e=>1+e),0)-1)}export{L as countPoints,R as densifyPath,S as isPolyline,A as isValidInputPath,v as toAbsoluteHeightElevation};
|
package/widgets/Expand.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/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import{aliasOf as t}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import s from"./Widget.js";import r from"./Expand/ExpandViewModel.js";import{isWidget as a,hasDomNode as d}from"./support/widget.js";import{
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{aliasOf as t}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import s from"./Widget.js";import r from"./Expand/ExpandViewModel.js";import{isWidget as a,hasDomNode as d}from"./support/widget.js";import{tsx as i}from"./support/jsxFactory.js";import{messageBundle as p}from"./support/decorators/messageBundle.js";import{accessibleHandler as l}from"./support/decorators/accessibleHandler.js";const c={base:"esri-expand esri-widget",modeAuto:"esri-expand--auto",modeDrawer:"esri-expand--drawer",modeFloating:"esri-expand--floating",container:"esri-expand__container",containerExpanded:"esri-expand__container--expanded",panel:"esri-expand__panel",button:"esri-widget--button",text:"esri-icon-font-fallback-text",icon:"esri-collapse__icon",iconExpanded:"esri-expand__icon--expanded",iconNumber:"esri-expand__icon-number",iconNumberExpanded:"esri-expand__icon-number--expanded",expandIcon:"esri-icon-expand",collapseIcon:"esri-icon-collapse",content:"esri-expand__content",contentExpanded:"esri-expand__content--expanded",expandMask:"esri-expand__mask",expandMaskExpanded:"esri-expand__mask--expanded"};let u=class extends s{constructor(e,t){super(e,t),this.autoCollapse=null,this.closeOnEsc=!0,this.collapseTooltip="",this.content="",this.expanded=null,this.expandTooltip="",this.group=null,this.iconNumber=0,this.label=void 0,this.messages=null,this.messagesCommon=null,this.mode="auto",this.view=null,this.viewModel=new r,this._handleKeyDown=e=>{const{closeOnEsc:t,_toggleButtonEl:o,expanded:n}=this;if(!n||!t||e.target===o||"Escape"!==e.key)return;("function"==typeof t?t(e):t)&&(this.expanded=!1,o?.focus())}}get contentId(){return`${this.id}_controls_content`}get expandTitle(){const{expanded:e,messagesCommon:t,collapseTooltip:o,expandTooltip:n}=this;return e?o||t.collapse:n||t.expand}get collapseIconClass(){return c.collapseIcon}set collapseIconClass(e){e?this._override("collapseIconClass",e):this._clearOverride("collapseIconClass")}get expandIconClass(){return a(this.content)?this.content.iconClass:c.expandIcon}set expandIconClass(e){e?this._override("expandIconClass",e):this._clearOverride("expandIconClass")}expand(){this.viewModel.expanded=!0}collapse(){this.viewModel.expanded=!1}toggle(){this.viewModel.expanded=!this.viewModel.expanded}render(){const{mode:e}=this,t={[c.modeAuto]:"auto"===e,[c.modeDrawer]:"drawer"===e,[c.modeFloating]:"floating"===e};return i("div",{class:this.classes(c.base,t),onkeydown:this._handleKeyDown},this.renderMask(),this.renderContainer())}renderContainer(){const{expanded:e}=this,t={[c.containerExpanded]:e};return i("div",{class:this.classes(c.container,t)},this.renderPanel(),this.renderContent())}renderMask(){const{expanded:e}=this,t={[c.expandMaskExpanded]:e};return i("div",{bind:this,onclick:this._toggle,class:this.classes(c.expandMask,t)})}renderBadgeNumber(){const{expanded:e,iconNumber:t}=this;return t&&!e?i("span",{key:"expand__icon-number",class:c.iconNumber},t):null}renderPanelNumber(){const{iconNumber:e,expanded:t}=this;return e&&t?i("span",{key:"expand__expand-icon-number",class:this.classes(c.iconNumber,c.iconNumberExpanded)},e):null}renderIcon(){const{collapseIconClass:e,expandIconClass:t,expanded:o}=this,n={[c.iconExpanded]:o,[e]:o,[t]:!o};return e===t&&(n[e]=!0),i("span",{"aria-hidden":"true",class:this.classes(c.icon,n)})}renderTitle(){return i("span",{class:c.text},this.expandTitle)}renderExpandButton(){const{expanded:e,expandTitle:t,contentId:o}=this;return i("div",{afterCreate:this._storeToggleButtonEl,"aria-controls":o,"aria-expanded":e?"true":"false",bind:this,class:c.button,onclick:this._toggle,onkeydown:this._toggle,role:"button",tabindex:"0",title:t},this.renderBadgeNumber(),this.renderIcon(),this.renderTitle())}renderPanel(){return i("div",{class:c.panel},this.renderExpandButton(),this.renderPanelNumber())}renderContent(){const{expanded:e,contentId:t,content:o}=this,n={[c.contentExpanded]:e},s={id:t,role:"region",class:this.classes(c.content,n)};return"string"==typeof o?i("div",{key:"content__string",innerHTML:o,...s}):a(o)?i("div",{key:"content__widget",...s},o.render()):o instanceof HTMLElement?i("div",{key:"content__html-element",bind:o,afterCreate:this._attachToNode,...s}):d(o)?i("div",{key:"content__node",bind:o.domNode,afterCreate:this._attachToNode,...s}):null}_toggle(){this.toggle()}_attachToNode(e){const t=this;e.appendChild(t)}_storeToggleButtonEl(e){this._toggleButtonEl=e}};e([o({readOnly:!0})],u.prototype,"contentId",null),e([o({readOnly:!0})],u.prototype,"expandTitle",null),e([t("viewModel.autoCollapse")],u.prototype,"autoCollapse",void 0),e([o()],u.prototype,"closeOnEsc",void 0),e([o()],u.prototype,"collapseIconClass",null),e([o()],u.prototype,"collapseTooltip",void 0),e([o()],u.prototype,"content",void 0),e([t("viewModel.expanded")],u.prototype,"expanded",void 0),e([o()],u.prototype,"expandIconClass",null),e([o()],u.prototype,"expandTooltip",void 0),e([t("viewModel.group")],u.prototype,"group",void 0),e([o()],u.prototype,"iconNumber",void 0),e([o({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],u.prototype,"label",void 0),e([o(),p("esri/widgets/Expand/t9n/Expand")],u.prototype,"messages",void 0),e([o(),p("esri/t9n/common")],u.prototype,"messagesCommon",void 0),e([o()],u.prototype,"mode",void 0),e([t("viewModel.view")],u.prototype,"view",void 0),e([o({type:r})],u.prototype,"viewModel",void 0),e([l()],u.prototype,"_toggle",null),u=e([n("esri.widgets.Expand")],u);const x=u;export{x 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/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../Color.js";import{isSymbol3D as l}from"../../../symbols.js";import{round as t,numDigits as o,percentChange as s}from"../../../renderers/support/numberUtils.js";import{applyCIMSymbolColor as n}from"../../../symbols/support/cimSymbolUtils.js";import{isVolumetricSymbol as i,getSymbolOutlineSize as r}from"../../../symbols/support/utils.js";import{
|
|
5
|
+
import e from"../../../Color.js";import{isSymbol3D as l}from"../../../symbols.js";import{round as t,numDigits as o,percentChange as s}from"../../../renderers/support/numberUtils.js";import{applyCIMSymbolColor as n}from"../../../symbols/support/cimSymbolUtils.js";import{isVolumetricSymbol as i,getSymbolOutlineSize as r}from"../../../symbols/support/utils.js";import{getSymbolForFlowRenderer as a,createStopLabel as u}from"./utils.js";import"../../support/widgetUtils.js";import{isDarkTheme as c}from"../../../support/themeUtils.js";import m from"../../../symbols/SimpleMarkerSymbol.js";import f from"../../../symbols/SimpleLineSymbol.js";const p=30,y=12,b=[255,255,255],h=[200,200,200],d=[128,128,128],w=20,g=5;function S(e){return"esri.symbols.SimpleMarkerSymbol"===e.declaredClass}function v(e){return"esri.symbols.PictureMarkerSymbol"===e.declaredClass}function z(e){return"esri.symbols.SimpleLineSymbol"===e.declaredClass}function j(e){return"esri.symbols.TextSymbol"===e.declaredClass}function V(e,l){const t=e.length-1;return e.map(((e,o)=>u(e,o,t,l)))}async function k(e,l,o,s,n,a){const u=l.legendOptions,c=u&&u.customValues,m=await U(e,o),f=!!m,p=!!c,y=null!=l.minSize&&null!=l.maxSize,b=l.stops&&l.stops.length>1,h=!!l.target;if(!f||!p&&!(y||b&&!h))return;const d=i(m);let w=null,g=null,S=null;g=d&&!b?t([l.minDataValue,l.maxDataValue]):c||await D(l,m,s,n);const v=e?.authoringInfo,z="univariate-color-size"===v?.type,j=z&&"above-and-below"===v?.univariateTheme;if(!g&&b&&(g=l.stops.map((e=>e.value)),w=l.stops.some((e=>!!e.label)),"flow"===e.type&&(g=t(g)),w&&(S=l.stops.map((e=>e.label)))),d&&g?.length>2&&!j&&(g=[g[0],g[g.length-1]]),!g)return null;z&&5!==g?.length&&(g=E({minSize:g[0],maxSize:g[g.length-1]}));const k=d?x(e,g):null,C=r(m),I=w?null:V(g,a);return(await Promise.all(g.map((async(t,o)=>{const i=d?k[o]:await B(l,m,t,s,n);return{value:t,symbol:P(j&&"class-breaks"===e.type?L(e,o):m,i),label:w?S[o]:I[o],size:i,outlineSize:C}})))).reverse()}function x(e,l){const t=e?.authoringInfo,o="univariate-color-size"===t?.type;let s=[y,p];if(o){const e=l[0],t=l[l.length-1],o=y,n=p;s=l.map((l=>o+(l-e)/(t-e)*(n-o)))}return o&&"below"===t?.univariateTheme&&s.reverse(),s}function L(e,l){const t=e.classBreakInfos,o=t.length,s=o<2||!(l>=2)?t[0].symbol.clone():t[o-1].symbol.clone();return e.visualVariables.some((e=>"color"===e.type))&&(s.type.includes("3d")?I(s):M(s)),s}async function U(e,l){if("flow"===e.type)return a(e,l);if("pie-chart"===e.type)return new m({color:null,outline:e.outline?.width?e.outline:new f});let t=null,o=null;if("simple"===e.type)t=e.symbol;else if("class-breaks"===e.type){const l=e.classBreakInfos;t=l&&l[0]&&l[0].symbol,o=l.length>1}else if("unique-value"===e.type){const l=e.uniqueValueInfos;t=l&&l[0]&&l[0].symbol,o=l.length>1}return!t||C(t)?null:(t=t.clone(),(l||o)&&(t.type.includes("3d")?I(t):M(t)),t)}function C(e){if(e){if(l(e)){return!!e.symbolLayers&&e.symbolLayers.some((e=>e&&"fill"===e.type))}return e.type.includes("fill")}return!1}function I(e){"line-3d"===e.type?e.symbolLayers.forEach((e=>{e.material={color:d}})):e.symbolLayers.forEach((e=>{"icon"!==e.type||e.resource&&e.resource.href?e.material={color:h}:(e.material={color:b},e.outline={color:d,size:1.5})}))}function M(l){const t=c();if("cim"===l.type)n(l,new e(h));else if(l.type.includes("line"))l.color=d;else if(l.color=t?d:b,"simple-marker"===l.type)if(l.outline){const e=l.outline?.color?.toHex();"#ffffff"===e&&(l.outline.color=d)}else l.outline={color:d,width:1.5}}async function D(e,l,o,s){const n=(await import("../../../renderers/visualVariables/support/visualVariableUtils.js")).getSizeRangeAtScale(e,o,s),i=n&&E(n);if(!n&&!i)return;let r=i.map((l=>T(l,e,n)));r=t(r);for(let t=1;t<r.length-1;t++){const n=await q(e,l,r[t],r[t-1],o,s);n&&(r[t]=n[0],i[t]=n[1])}return r}function E(e){const l=e.minSize,t=e.maxSize,o=g,s=(t-l)/(o-1),n=[];for(let i=0;i<o;i++)n.push(l+s*i);return n}function T(e,l,t){const o=t.minSize,s=t.maxSize,n=l.minDataValue,i=l.maxDataValue;let r=null;if(e<=o)r=n;else if(e>=s)r=i;else{r=(e-o)/(s-o)*(i-n)+n}return r}async function q(e,l,n,i,r,a){const u=await B(e,l,n,r,a),c=await B(e,l,i,r,a),m=o(n),f=m.fractional,p=w;let y=m.integer,b=null,h=null;n>0&&n<1&&(b=10**f,y=o(n*=b).integer);for(let o=y-1;o>=0;o--){const i=10**o;let m=Math.floor(n/i)*i,f=Math.ceil(n/i)*i;null!=b&&(m/=b,f/=b);let y=(m+f)/2;[,y]=t([m,y,f],{indexes:[1]});const d=await B(e,l,m,r,a),w=await B(e,l,f,r,a),g=await B(e,l,y,r,a),S=s(u,d,c,null),v=s(u,w,c,null),z=s(u,g,c,null);let j=S.previous<=p,V=v.previous<=p;if(j&&V&&(S.previous<=v.previous?(j=!0,V=!1):(V=!0,j=!1)),j?h=[m,d]:V?h=[f,w]:z.previous<=p&&(h=[y,g]),h)break}return h}async function B(e,l,t,o,s){const{getSize:n}=await import("../../../renderers/visualVariables/support/visualVariableUtils.js");return n(e,t,{scale:o,view:s,shape:"simple-marker"===l.type?l.style:null})}function P(e,t){const o=e.clone();if(l(o))i(o)||o.symbolLayers.forEach((e=>{"fill"!==e.type&&(e.size=t)}));else if(S(o))o.size=t;else if(v(o)){const e=o.width,l=o.height;o.height=t,o.width=t*(e/l)}else z(o)?o.width=t:j(o)&&o.font&&(o.font.size=t);return o}export{p as REAL_WORLD_MAX_SIZE,y as REAL_WORLD_MIN_SIZE,k as getRampStops};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../analysis/LineOfSightAnalysis.js";import s from"../../analysis/LineOfSightAnalysisObserver.js";import o from"../../analysis/LineOfSightAnalysisTarget.js";import i from"../../core/Collection.js";import{
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../analysis/LineOfSightAnalysis.js";import s from"../../analysis/LineOfSightAnalysisObserver.js";import o from"../../analysis/LineOfSightAnalysisTarget.js";import i from"../../core/Collection.js";import{referenceSetter as n,castForReferenceSetter as r}from"../../core/collectionUtils.js";import a from"../../core/Handles.js";import{handlesGroup as l}from"../../core/handleUtils.js";import{destroyMaybe as d,isNone as h,isSome as c,applySome as g,unwrap as y}from"../../core/maybe.js";import{watch as p,syncAndInitial as m,sync as T}from"../../core/reactiveUtils.js";import{property as v}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";import u from"./LineOfSightTarget.js";import{AnalysisViewModel as w}from"../support/AnalysisViewModel.js";const f=i.ofType(u);let A=class extends w{constructor(e){super(e),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="LineOfSightViewModel is only supported in 3D views.",this._handles=new a,this._vmTargetsToConnection=new Map,this._analysisTargetsToConnection=new Map}initialize(){this._handles.add([this.targets.on("after-add",(e=>this._onViewModelTargetAdded(e.item))),this.targets.on("after-remove",(e=>this._onViewModelTargetRemoved(e.item))),p((()=>this.analysis),(e=>this._onAnalysisChange(e)),m)])}destroy(){this._analysisTargetsToConnection.forEach((e=>e.remove())),this._handles=d(this._handles)}get state(){return this.disabled||!this.ready?"disabled":h(this.tool)?"ready":this.tool.state}get observer(){return c(this.analysis.observer)?this.analysis.observer.position:null}set observer(e){this.analysis.observer=new s({position:e})}get targets(){return this._get("targets")||new f}set targets(e){this._set("targets",n(e,this.targets,f))}continue(){c(this.tool)&&this.tool.continue()}stop(){c(this.tool)&&this.tool.stop()}get testInfo(){return{analysisView:this.analysisView,getAnalysisTargetFromViewModelTarget:e=>g(this._vmTargetsToConnection.get(e),(e=>e.analysisTarget))}}constructAnalysis(){return new t}async onConnectToAnalysisView(e){this._handles.add([e.on("result-changed",(e=>{const t=this._analysisTargetsToConnection.get(e.target);c(e.result)?(t.viewModelTarget.intersectedGraphic=e.result.intersectedGraphic,t.viewModelTarget.intersectedLocation=y(e.result.intersectedLocation),t.viewModelTarget.visible=e.result.visible):(t.viewModelTarget.intersectedGraphic=null,t.viewModelTarget.intersectedLocation=null,t.viewModelTarget.visible=void 0)}))],"view")}onDisconnectFromAnalysisView(){null!=this._handles&&this._handles.remove("view")}_onViewModelTargetAdded(e){if(this._vmTargetsToConnection.get(e))return;const t=new o({position:e.location});this._connectViewModelWithAnalysisTarget(e,t),this.analysis.targets.add(t)}_onViewModelTargetRemoved(e){const t=this._vmTargetsToConnection.get(e);t&&(t.remove(),this.analysis.targets.remove(t.analysisTarget))}_onAnalysisTargetAdded(e){if(this._analysisTargetsToConnection.get(e))return;const t=new u({location:g(e.position,(e=>e.clone()))});this._connectViewModelWithAnalysisTarget(t,e),this.targets.add(t)}_onAnalysisTargetRemoved(e){const t=this._analysisTargetsToConnection.get(e);t&&(t.remove(),this.targets.remove(t.viewModelTarget))}_connectViewModelWithAnalysisTarget(e,t){let s=!1;const o=l([p((()=>t.position),(t=>{s||(s=!0,e.location=g(t,(e=>e.clone())),s=!1)}),T),p((()=>e.location),(e=>{s||(s=!0,t.position=g(e,(e=>e.clone())),s=!1)}),T)]),i={analysisTarget:t,viewModelTarget:e,remove:()=>{o.remove(),this._vmTargetsToConnection.delete(e),this._analysisTargetsToConnection.delete(t)}};this._vmTargetsToConnection.set(e,i),this._analysisTargetsToConnection.set(t,i)}_onAnalysisChange(e){const t="analysis";this._handles.remove(t),this._handles.add([this.analysis.targets.on("after-add",(e=>this._onAnalysisTargetAdded(e.item))),this.analysis.targets.on("after-remove",(e=>this._onAnalysisTargetRemoved(e.item)))],t),this.targets.removeAll(),e.targets.forEach((e=>{this._onAnalysisTargetAdded(e)}))}};e([v({type:t})],A.prototype,"analysis",void 0),e([v({readOnly:!0})],A.prototype,"state",null),e([v()],A.prototype,"observer",null),e([v({type:f,cast:r,nonNullable:!0})],A.prototype,"targets",null),A=e([_("esri.widgets.lineOfSight.LineOfSightViewModel")],A);const M=A;export{M 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/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../symbols.js";import i from"../../core/Collection.js";import s from"../../core/Error.js";import r from"../../core/Handles.js";import o from"../../core/Logger.js";import{unwrap as n,isNone as a}from"../../core/maybe.js";import{watch as l,when as h,sync as u}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{geographicToWebMercator as p}from"../../geometry/support/webMercatorUtils.js";import g from"../../layers/Layer.js";import f from"../../support/actions/ActionBase.js";import m from"../../support/actions/ActionButton.js";import y from"../../support/actions/ActionToggle.js";import{getDisplayedSymbol as w}from"../../symbols/support/symbolUtils.js";import{ViewEventPriorities as F}from"../../views/input/InputManager.js";import{highlightsSupported as v}from"../../views/support/layerViewUtils.js";import _ from"../Feature/FeatureViewModel.js";import{zoomToClusteredFeatures as b,browseClusteredFeatures as C,zoomToFeature as P}from"./actions.js";import{triggerAction as E,isClusterFeature as V,getSelectedTarget as A,removeClusteredFeaturesForBrowsing as M,displayClusterExtent as j,browseAggregateFeatures as L}from"./actionUtils.js";import O from"../support/AnchorElementViewModel.js";import{GoToMixin as x}from"../support/GoTo.js";import I from"../../symbols/SimpleFillSymbol.js";import T from"../../geometry/Point.js";const S=i.ofType({key:"type",defaultKeyValue:"button",base:f,typeMap:{button:m,toggle:y}}),B=()=>[P.clone()],R=()=>[b.clone(),C.clone()];let G=class extends(x(O)){constructor(e){super(e),this._handles=new r,this._pendingPromises=new Set,this._fetchFeaturesController=null,this._selectedClusterFeature=null,this.featurePage=null,this.actions=new S,this.activeFeature=null,this.defaultPopupTemplateEnabled=!1,this.autoCloseEnabled=!1,this.autoOpenEnabled=!0,this.browseClusterEnabled=!1,this.content=null,this.featuresPerPage=20,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.selectedClusterBoundaryFeature=new t({symbol:new I({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null}get isLoadingFeature(){return this.featureViewModels.some((e=>e.waitingForContent))}initialize(){this._handles.add([l((()=>[this.autoOpenEnabled,this.view]),(()=>this._autoOpenEnabledChange())),this.on("view-change",(()=>this._autoClose())),l((()=>[this.highlightEnabled,this.selectedFeature,this.visible,this.view]),(()=>this._highlightSelectedFeature())),l((()=>[this.highlightEnabled,this.activeFeature,this.visible,this.view]),(()=>this._highlightActiveFeature())),l((()=>this.view?.animation?.state),(e=>this._animationStateChange(e))),l((()=>this.location),(e=>this._locationChange(e))),l((()=>this.selectedFeature),(e=>this._selectedFeatureChange(e))),l((()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage]),(()=>this._selectedFeatureIndexChange())),l((()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureViewModels]),(()=>this._setGraphicOnFeatureViewModels())),l((()=>this.featureViewModels),(()=>this._featureViewModelsChange())),this.on("trigger-action",(e=>E({event:e,view:this.view}))),h((()=>!this.waitingForResult),(()=>this._waitingForResultChange()),u),l((()=>[this.features,this.view?.map,this.view?.spatialReference]),(()=>this._updateFeatureVMs())),l((()=>this.view?.scale),(()=>this._viewScaleChange())),h((()=>!this.visible),(()=>this.browseClusterEnabled=!1)),l((()=>this.browseClusterEnabled),(e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing()))])}destroy(){this._cancelFetchingFeatures(),this._handles.destroy(),this._handles=null,this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new S;e.removeAll();const{actions:t,defaultActions:i,defaultPopupTemplateEnabled:s,includeDefaultActions:r,selectedFeature:o}=this,n=r?i.concat(t):t,a=o&&("function"==typeof o.getEffectivePopupTemplate&&o.getEffectivePopupTemplate(s)||o.popupTemplate),l=a&&a.actions,h=a&&a.overwriteActions?l:l?l.concat(n):n;return h&&h.filter(Boolean).forEach((t=>e.add(t))),e}get defaultActions(){const e=this._get("defaultActions")||new S;return e.removeAll(),e.addMany(V(this.selectedFeature)?R():B()),e}get featureCount(){return this.features.length}get features(){return this._get("features")||[]}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:i,promiseCount:s,selectedFeatureIndex:r}=this,o=s&&t.length;o&&i&&-1===r?this.selectedFeatureIndex=0:o&&-1!==r||(this.selectedFeatureIndex=t.length?0:-1)}get location(){return this._get("location")||null}set location(e){const t=this.get("view.spatialReference.isWebMercator");e&&e.get("spatialReference.isWGS84")&&t&&(e=p(e)),this._set("location",e)}get pendingPromisesCount(){return this._pendingPromises.size}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){if(this._pendingPromises.clear(),this.features=[],!Array.isArray(e)||!e.length)return this._set("promises",[]),void this.notifyChange("pendingPromisesCount");this._set("promises",e),(e=e.slice(0)).forEach((e=>{this._pendingPromises.add(e);const t=t=>{this._pendingPromises.has(e)&&this._updateFeatures(t),this._updatePendingPromises(e)},i=()=>this._updatePendingPromises(e);e.then(t,i)})),this.notifyChange("pendingPromisesCount")}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;e=isNaN(e)||e<-1||!t?-1:(e+t)%t,this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get state(){return this.get("view.ready")?"ready":"disabled"}centerAtLocation(){const{view:e}=this,t=A(this);return t?this.callGoTo({target:{target:t,scale:e.scale}}):Promise.reject(new s("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:i}=this;if(!i||!e)throw new s("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:i});return i.fetchPopupFeatures(e,{event:t&&t.event,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t&&t.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:i}=t;delete t.fetchFeatures,i&&this._setFetchFeaturesPromises(t.location);const s=["actionsMenuOpen","collapsed","featureMenuOpen"];for(const r of s)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.getItemAt(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex=this.selectedFeatureIndex+1,this}previous(){return this.selectedFeatureIndex=this.selectedFeatureIndex-1,this}disableClusterBrowsing(){M(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){const{view:e,selectedFeature:t}=this;"2d"===e?.type?V(t)?(await j(this),await L(this)):o.getLogger(this.declaredClass).warn("enableClusterBrowsing:invalid-selectedFeature: Selected feature must represent an aggregate/cluster graphic.",t):o.getLogger(this.declaredClass).warn("enableClusterBrowsing:invalid-view: View must be 2d MapView.",t)}_animationStateChange(e){this.zoomToLocation||(P.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){const e=this.view?.graphics;e&&(e.remove(this.selectedClusterBoundaryFeature),e.remove(this._selectedClusterFeature)),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(V(this.selectedFeature))return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.features=[this.selectedFeature])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i}=this;i&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>1?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>1?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:s,featureViewModels:r}=this;if(null===i)return;const o=((i-1)*s+t)%t,n=o+s;r.slice(o,n).forEach(((t,i)=>{t&&!t.graphic&&(t.graphic=e[o+i])}))}async _selectedFeatureChange(e){if(!e)return;const{location:t,updateLocationEnabled:i,view:s}=this;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(s.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),V(e))return;return e.symbol=await w(e),this._selectedClusterFeature=e,void s.graphics.add(this._selectedClusterFeature)}!i&&t||!e.geometry?i&&!e.geometry&&this.centerAtLocation().then((()=>{this.location=s.center.clone()})):this.location=n(this._getPointFromGeometry(e.geometry))}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}_setFetchFeaturesPromises(e){return this._fetchFeaturesWithController(this._getScreenPoint(e||this.location)).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:i}=e,s=Promise.resolve(t),r=i.map((e=>e.promise));this.promises=[s,...r]}))}_destroyFeatureVMs(){this.featureViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:i}=this;if(V(e)||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t||!t.length)return;const s=i.slice(0),r=[];t.forEach(((t,i)=>{if(!t)return;let o=null;if(s.some(((e,i)=>(e&&e.graphic===t&&(o=e,s.splice(i,1)),!!o))),o)r[i]=o;else{const s=new _({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:this.view?.spatialReference,graphic:t===e?t:null,map:this.view?.map,view:this.view});r[i]=s}})),s.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",r)}_getScreenPoint(e){const{view:t}=this;return t&&e&&"function"==typeof t.toScreen?t.toScreen(e):null}_autoOpenEnabledChange(){const e="auto-fetch-features",{_handles:t,autoOpenEnabled:i}=this;if(t.remove(e),i&&this.view){const i=this.view.on("click",(e=>{"mouse"===e.pointerType&&0!==e.button||this._fetchFeaturesAndOpen(e)}),F.WIDGET);t.add(i,e)}}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null,this.notifyChange("waitingForResult")}_fetchFeaturesWithController(e,t){this._cancelFetchingFeatures();const i=new AbortController,{signal:s}=i;this._fetchFeaturesController=i,this.notifyChange("waitingForResult");const r=this.fetchFeatures(e,{signal:s,event:t});return r.catch((()=>{})).then((()=>{this._fetchFeaturesController=null,this.notifyChange("waitingForResult")})),r}_fetchFeaturesAndOpen(e){const{screenPoint:t,mapPoint:i}=e,{view:s}=this;this._fetchFeaturesWithController(t,e).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:r,location:o}=e,n=[Promise.resolve(t),...r.map((e=>e.promise))];return s.popup.open({location:o||i,promises:n}),e}))}_updatePendingPromises(e){e&&this._pendingPromises.has(e)&&(this._pendingPromises.delete(e),this.notifyChange("pendingPromisesCount"))}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}_getPointFromGeometry(e){return a(e)?null:"point"===e.type?e:"extent"===e.type?e.center:"polygon"===e.type?e.centroid:"multipoint"===e.type||"polyline"===e.type?e.extent.center:null}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:i}=e;return"map-notes"===i?.type||"subtype-group"===i?.type?i:t}_getHighlightTarget(e,t){const i="imagery"===t.type?void 0:"objectIdField"in t&&t.objectIdField,s=e.attributes;return s&&i&&s[i]||e}async _highlightActiveFeature(){const e="highlight-active-feature";this._handles.remove(e);const{highlightEnabled:t,view:i,activeFeature:s,visible:r}=this;if(!(s&&i&&t&&r))return;const o=this._getHighlightLayer(s);if(!(o&&o instanceof g))return;const n=this._getLayerView(i,o);this._highlightActiveFeaturePromise=n;const a=await n;if(!(a&&v(a)&&this._highlightActiveFeaturePromise===n&&this.activeFeature&&this.highlightEnabled))return;const l=a.highlight(this._getHighlightTarget(s,o));this._handles.add(l,e)}async _highlightSelectedFeature(){const e="highlight-selected-feature";this._handles.remove(e);const{selectedFeature:t,highlightEnabled:i,view:s,visible:r}=this;if(!(t&&s&&i&&r))return;const o=this._getHighlightLayer(t);if(!(o&&o instanceof g))return;const n=this._getLayerView(s,o);this._highlightSelectedFeaturePromise=n;const a=await n;if(!(a&&v(a)&&this._highlightSelectedFeaturePromise===n&&this.selectedFeature&&this.highlightEnabled&&this.visible))return;const l=a.highlight(this._getHighlightTarget(t,o));this._handles.add(l,e)}_updateFeatures(e){const{features:t}=this;if(!e||!e.length)return;if(!t.length)return void(this.features=e);const i=e.filter((e=>!t.includes(e)));this.features=t.concat(i)}};e([c()],G.prototype,"featurePage",void 0),e([c()],G.prototype,"isLoadingFeature",null),e([c({type:S})],G.prototype,"actions",void 0),e([c({readOnly:!0})],G.prototype,"active",null),e([c()],G.prototype,"activeFeature",void 0),e([c({readOnly:!0})],G.prototype,"allActions",null),e([c({type:Boolean})],G.prototype,"defaultPopupTemplateEnabled",void 0),e([c()],G.prototype,"autoCloseEnabled",void 0),e([c()],G.prototype,"autoOpenEnabled",void 0),e([c()],G.prototype,"browseClusterEnabled",void 0),e([c()],G.prototype,"content",void 0),e([c({type:S,readOnly:!0})],G.prototype,"defaultActions",null),e([c({readOnly:!0})],G.prototype,"featureCount",null),e([c()],G.prototype,"features",null),e([c()],G.prototype,"featuresPerPage",void 0),e([c()],G.prototype,"featureViewModelAbilities",void 0),e([c({readOnly:!0})],G.prototype,"featureViewModels",void 0),e([c()],G.prototype,"highlightEnabled",void 0),e([c()],G.prototype,"includeDefaultActions",void 0),e([c({type:T})],G.prototype,"location",null),e([c({readOnly:!0})],G.prototype,"pendingPromisesCount",null),e([c({readOnly:!0})],G.prototype,"selectedClusterBoundaryFeature",void 0),e([c({readOnly:!0})],G.prototype,"waitingForResult",null),e([c({readOnly:!0})],G.prototype,"promiseCount",null),e([c()],G.prototype,"promises",null),e([c({value:null,readOnly:!0})],G.prototype,"selectedFeature",null),e([c({value:-1})],G.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],G.prototype,"selectedFeatureViewModel",null),e([c({readOnly:!0})],G.prototype,"state",null),e([c()],G.prototype,"title",void 0),e([c()],G.prototype,"updateLocationEnabled",void 0),e([c()],G.prototype,"view",void 0),e([c()],G.prototype,"visible",void 0),e([c()],G.prototype,"zoomFactor",void 0),e([c()],G.prototype,"zoomToLocation",void 0),e([c()],G.prototype,"centerAtLocation",null),G=e([d("esri.widgets.Popup.PopupViewModel")],G);const z=G;export{z as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../symbols.js";import i from"../../core/Collection.js";import s from"../../core/Error.js";import r from"../../core/Handles.js";import o from"../../core/Logger.js";import{unwrap as n,isNone as a}from"../../core/maybe.js";import{watch as l,when as h,sync as u}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{geographicToWebMercator as p}from"../../geometry/support/webMercatorUtils.js";import g from"../../layers/Layer.js";import f from"../../support/actions/ActionBase.js";import m from"../../support/actions/ActionButton.js";import y from"../../support/actions/ActionToggle.js";import{getDisplayedSymbol as w}from"../../symbols/support/symbolUtils.js";import{ViewEventPriorities as F}from"../../views/input/InputManager.js";import{highlightsSupported as v}from"../../views/support/layerViewUtils.js";import _ from"../Feature/FeatureViewModel.js";import{zoomToFeature as b,zoomToClusteredFeatures as C,browseClusteredFeatures as P}from"./actions.js";import{triggerAction as E,isClusterFeature as V,getSelectedTarget as A,removeClusteredFeaturesForBrowsing as M,displayClusterExtent as j,browseAggregateFeatures as L}from"./actionUtils.js";import O from"../support/AnchorElementViewModel.js";import{GoToMixin as x}from"../support/GoTo.js";import I from"../../symbols/SimpleFillSymbol.js";import T from"../../geometry/Point.js";const S=i.ofType({key:"type",defaultKeyValue:"button",base:f,typeMap:{button:m,toggle:y}}),B=()=>[b.clone()],R=()=>[C.clone(),P.clone()];let G=class extends(x(O)){constructor(e){super(e),this._handles=new r,this._pendingPromises=new Set,this._fetchFeaturesController=null,this._selectedClusterFeature=null,this.featurePage=null,this.actions=new S,this.activeFeature=null,this.defaultPopupTemplateEnabled=!1,this.autoCloseEnabled=!1,this.autoOpenEnabled=!0,this.browseClusterEnabled=!1,this.content=null,this.featuresPerPage=20,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.selectedClusterBoundaryFeature=new t({symbol:new I({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null}get isLoadingFeature(){return this.featureViewModels.some((e=>e.waitingForContent))}initialize(){this._handles.add([l((()=>[this.autoOpenEnabled,this.view]),(()=>this._autoOpenEnabledChange())),this.on("view-change",(()=>this._autoClose())),l((()=>[this.highlightEnabled,this.selectedFeature,this.visible,this.view]),(()=>this._highlightSelectedFeature())),l((()=>[this.highlightEnabled,this.activeFeature,this.visible,this.view]),(()=>this._highlightActiveFeature())),l((()=>this.view?.animation?.state),(e=>this._animationStateChange(e))),l((()=>this.location),(e=>this._locationChange(e))),l((()=>this.selectedFeature),(e=>this._selectedFeatureChange(e))),l((()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage]),(()=>this._selectedFeatureIndexChange())),l((()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureViewModels]),(()=>this._setGraphicOnFeatureViewModels())),l((()=>this.featureViewModels),(()=>this._featureViewModelsChange())),this.on("trigger-action",(e=>E({event:e,view:this.view}))),h((()=>!this.waitingForResult),(()=>this._waitingForResultChange()),u),l((()=>[this.features,this.view?.map,this.view?.spatialReference]),(()=>this._updateFeatureVMs())),l((()=>this.view?.scale),(()=>this._viewScaleChange())),h((()=>!this.visible),(()=>this.browseClusterEnabled=!1)),l((()=>this.browseClusterEnabled),(e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing()))])}destroy(){this._cancelFetchingFeatures(),this._handles.destroy(),this._handles=null,this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new S;e.removeAll();const{actions:t,defaultActions:i,defaultPopupTemplateEnabled:s,includeDefaultActions:r,selectedFeature:o}=this,n=r?i.concat(t):t,a=o&&("function"==typeof o.getEffectivePopupTemplate&&o.getEffectivePopupTemplate(s)||o.popupTemplate),l=a&&a.actions,h=a&&a.overwriteActions?l:l?l.concat(n):n;return h&&h.filter(Boolean).forEach((t=>e.add(t))),e}get defaultActions(){const e=this._get("defaultActions")||new S;return e.removeAll(),e.addMany(V(this.selectedFeature)?R():B()),e}get featureCount(){return this.features.length}get features(){return this._get("features")||[]}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:i,promiseCount:s,selectedFeatureIndex:r}=this,o=s&&t.length;o&&i&&-1===r?this.selectedFeatureIndex=0:o&&-1!==r||(this.selectedFeatureIndex=t.length?0:-1)}get location(){return this._get("location")||null}set location(e){const t=this.get("view.spatialReference.isWebMercator");e&&e.get("spatialReference.isWGS84")&&t&&(e=p(e)),this._set("location",e)}get pendingPromisesCount(){return this._pendingPromises.size}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){if(this._pendingPromises.clear(),this.features=[],!Array.isArray(e)||!e.length)return this._set("promises",[]),void this.notifyChange("pendingPromisesCount");this._set("promises",e),(e=e.slice(0)).forEach((e=>{this._pendingPromises.add(e);const t=t=>{this._pendingPromises.has(e)&&this._updateFeatures(t),this._updatePendingPromises(e)},i=()=>this._updatePendingPromises(e);e.then(t,i)})),this.notifyChange("pendingPromisesCount")}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;e=isNaN(e)||e<-1||!t?-1:(e+t)%t,this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get state(){return this.get("view.ready")?"ready":"disabled"}centerAtLocation(){const{view:e}=this,t=A(this);return t?this.callGoTo({target:{target:t,scale:e.scale}}):Promise.reject(new s("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:i}=this;if(!i||!e)throw new s("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:i});return i.fetchPopupFeatures(e,{event:t&&t.event,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t&&t.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:i}=t;delete t.fetchFeatures,i&&this._setFetchFeaturesPromises(t.location);const s=["actionsMenuOpen","collapsed","featureMenuOpen"];for(const r of s)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.getItemAt(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex=this.selectedFeatureIndex+1,this}previous(){return this.selectedFeatureIndex=this.selectedFeatureIndex-1,this}disableClusterBrowsing(){M(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){const{view:e,selectedFeature:t}=this;"2d"===e?.type?V(t)?(await j(this),await L(this)):o.getLogger(this.declaredClass).warn("enableClusterBrowsing:invalid-selectedFeature: Selected feature must represent an aggregate/cluster graphic.",t):o.getLogger(this.declaredClass).warn("enableClusterBrowsing:invalid-view: View must be 2d MapView.",t)}_animationStateChange(e){this.zoomToLocation||(b.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){const e=this.view?.graphics;e&&(e.remove(this.selectedClusterBoundaryFeature),e.remove(this._selectedClusterFeature)),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(V(this.selectedFeature))return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.features=[this.selectedFeature])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i}=this;i&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>1?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>1?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:s,featureViewModels:r}=this;if(null===i)return;const o=((i-1)*s+t)%t,n=o+s;r.slice(o,n).forEach(((t,i)=>{t&&!t.graphic&&(t.graphic=e[o+i])}))}async _selectedFeatureChange(e){if(!e)return;const{location:t,updateLocationEnabled:i,view:s}=this;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(s.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),V(e))return;return e.symbol=await w(e),this._selectedClusterFeature=e,void s.graphics.add(this._selectedClusterFeature)}!i&&t||!e.geometry?i&&!e.geometry&&this.centerAtLocation().then((()=>{this.location=s.center.clone()})):this.location=n(this._getPointFromGeometry(e.geometry))}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}_setFetchFeaturesPromises(e){return this._fetchFeaturesWithController(this._getScreenPoint(e||this.location)).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:i}=e,s=Promise.resolve(t),r=i.map((e=>e.promise));this.promises=[s,...r]}))}_destroyFeatureVMs(){this.featureViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:i}=this;if(V(e)||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t||!t.length)return;const s=i.slice(0),r=[];t.forEach(((t,i)=>{if(!t)return;let o=null;if(s.some(((e,i)=>(e&&e.graphic===t&&(o=e,s.splice(i,1)),!!o))),o)r[i]=o;else{const s=new _({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:this.view?.spatialReference,graphic:t===e?t:null,map:this.view?.map,view:this.view});r[i]=s}})),s.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",r)}_getScreenPoint(e){const{view:t}=this;return t&&e&&"function"==typeof t.toScreen?t.toScreen(e):null}_autoOpenEnabledChange(){const e="auto-fetch-features",{_handles:t,autoOpenEnabled:i}=this;if(t.remove(e),i&&this.view){const i=this.view.on("click",(e=>{"mouse"===e.pointerType&&0!==e.button||this._fetchFeaturesAndOpen(e)}),F.WIDGET);t.add(i,e)}}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null,this.notifyChange("waitingForResult")}_fetchFeaturesWithController(e,t){this._cancelFetchingFeatures();const i=new AbortController,{signal:s}=i;this._fetchFeaturesController=i,this.notifyChange("waitingForResult");const r=this.fetchFeatures(e,{signal:s,event:t});return r.catch((()=>{})).then((()=>{this._fetchFeaturesController=null,this.notifyChange("waitingForResult")})),r}_fetchFeaturesAndOpen(e){const{screenPoint:t,mapPoint:i}=e,{view:s}=this;this._fetchFeaturesWithController(t,e).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:r,location:o}=e,n=[Promise.resolve(t),...r.map((e=>e.promise))];return s.popup.open({location:o||i,promises:n}),e}))}_updatePendingPromises(e){e&&this._pendingPromises.has(e)&&(this._pendingPromises.delete(e),this.notifyChange("pendingPromisesCount"))}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}_getPointFromGeometry(e){return a(e)?null:"point"===e.type?e:"extent"===e.type?e.center:"polygon"===e.type?e.centroid:"multipoint"===e.type||"polyline"===e.type?e.extent?.center:null}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:i}=e;return"map-notes"===i?.type||"subtype-group"===i?.type?i:t}_getHighlightTarget(e,t){const i="imagery"===t.type?void 0:"objectIdField"in t&&t.objectIdField,s=e.attributes;return s&&i&&s[i]||e}async _highlightActiveFeature(){const e="highlight-active-feature";this._handles.remove(e);const{highlightEnabled:t,view:i,activeFeature:s,visible:r}=this;if(!(s&&i&&t&&r))return;const o=this._getHighlightLayer(s);if(!(o&&o instanceof g))return;const n=this._getLayerView(i,o);this._highlightActiveFeaturePromise=n;const a=await n;if(!(a&&v(a)&&this._highlightActiveFeaturePromise===n&&this.activeFeature&&this.highlightEnabled))return;const l=a.highlight(this._getHighlightTarget(s,o));this._handles.add(l,e)}async _highlightSelectedFeature(){const e="highlight-selected-feature";this._handles.remove(e);const{selectedFeature:t,highlightEnabled:i,view:s,visible:r}=this;if(!(t&&s&&i&&r))return;const o=this._getHighlightLayer(t);if(!(o&&o instanceof g))return;const n=this._getLayerView(s,o);this._highlightSelectedFeaturePromise=n;const a=await n;if(!(a&&v(a)&&this._highlightSelectedFeaturePromise===n&&this.selectedFeature&&this.highlightEnabled&&this.visible))return;const l=a.highlight(this._getHighlightTarget(t,o));this._handles.add(l,e)}_updateFeatures(e){const{features:t}=this;if(!e||!e.length)return;if(!t.length)return void(this.features=e);const i=e.filter((e=>!t.includes(e)));this.features=t.concat(i)}};e([c()],G.prototype,"featurePage",void 0),e([c()],G.prototype,"isLoadingFeature",null),e([c({type:S})],G.prototype,"actions",void 0),e([c({readOnly:!0})],G.prototype,"active",null),e([c()],G.prototype,"activeFeature",void 0),e([c({readOnly:!0})],G.prototype,"allActions",null),e([c({type:Boolean})],G.prototype,"defaultPopupTemplateEnabled",void 0),e([c()],G.prototype,"autoCloseEnabled",void 0),e([c()],G.prototype,"autoOpenEnabled",void 0),e([c()],G.prototype,"browseClusterEnabled",void 0),e([c()],G.prototype,"content",void 0),e([c({type:S,readOnly:!0})],G.prototype,"defaultActions",null),e([c({readOnly:!0})],G.prototype,"featureCount",null),e([c()],G.prototype,"features",null),e([c()],G.prototype,"featuresPerPage",void 0),e([c()],G.prototype,"featureViewModelAbilities",void 0),e([c({readOnly:!0})],G.prototype,"featureViewModels",void 0),e([c()],G.prototype,"highlightEnabled",void 0),e([c()],G.prototype,"includeDefaultActions",void 0),e([c({type:T})],G.prototype,"location",null),e([c({readOnly:!0})],G.prototype,"pendingPromisesCount",null),e([c({readOnly:!0})],G.prototype,"selectedClusterBoundaryFeature",void 0),e([c({readOnly:!0})],G.prototype,"waitingForResult",null),e([c({readOnly:!0})],G.prototype,"promiseCount",null),e([c()],G.prototype,"promises",null),e([c({value:null,readOnly:!0})],G.prototype,"selectedFeature",null),e([c({value:-1})],G.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],G.prototype,"selectedFeatureViewModel",null),e([c({readOnly:!0})],G.prototype,"state",null),e([c()],G.prototype,"title",void 0),e([c()],G.prototype,"updateLocationEnabled",void 0),e([c()],G.prototype,"view",void 0),e([c()],G.prototype,"visible",void 0),e([c()],G.prototype,"zoomFactor",void 0),e([c()],G.prototype,"zoomToLocation",void 0),e([c()],G.prototype,"centerAtLocation",null),G=e([d("esri.widgets.Popup.PopupViewModel")],G);const z=G;export{z 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/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../core/Error.js";import t from"../../core/Logger.js";import{throwIfNotAbortError as r}from"../../core/promiseUtils.js";import{zoomToFeature as
|
|
5
|
+
import e from"../../core/Error.js";import t from"../../core/Logger.js";import{throwIfNotAbortError as r}from"../../core/promiseUtils.js";import{zoomToFeature as i,zoomToClusteredFeatures as o,browseClusteredFeatures as n,removeSelectedFeature as a}from"./actions.js";const s="esri.widgets.Popup.PopupViewModel",c=t.getLogger(s),u=t=>{const{event:s,view:c}=t,{action:u}=s,d=c&&c.popup;if(!u)return Promise.reject(new e("trigger-action:missing-arguments","Event has no action"));if(!d)return Promise.reject(new e("trigger-action:missing-arguments","view.popup is missing"));const{disabled:l,id:g}=u;if(!g)return Promise.reject(new e("trigger-action:invalid-action","action.id is missing"));if(l)return Promise.reject(new e("trigger-action:invalid-action","Action is disabled"));if(g===i.id)return w(d.viewModel).catch(r);if(g===o.id)return p(d.viewModel);if(g===n.id)return d.featureMenuOpen=!d.featureMenuOpen,d.viewModel.browseClusterEnabled=!d.viewModel.browseClusterEnabled,Promise.resolve();if(d.viewModel.browseClusterEnabled=!1,g===a.id){d.close();const{selectedFeature:t}=d;if(!t)return Promise.reject(new e(`trigger-action:${a.id}`,"selectedFeature is required",{selectedFeature:t}));const{sourceLayer:r}=t;return r?r.remove(t):c.graphics.remove(t),Promise.resolve()}return Promise.resolve()};function d(e){const{selectedFeature:t,location:r,view:i}=e;if(!i)return null;if("3d"===i.type)return t||r;return e.get("selectedFeature.geometry")||r}function l(e){return e?.isAggregate&&"cluster"===e?.sourceLayer?.featureReduction?.type}async function g(e,t){if("3d"!==t?.type||!e||"esri.Graphic"!==e.declaredClass)return!0;const r=t.getViewForGraphic(e);if(r&&"whenGraphicBounds"in r){let t;try{t=await r.whenGraphicBounds(e,{useViewElevation:!0})}catch(i){}return!t||!t.boundingBox||t.boundingBox[0]===t.boundingBox[3]&&t.boundingBox[1]===t.boundingBox[4]&&t.boundingBox[2]===t.boundingBox[5]}return!0}async function w(t){const{location:r,selectedFeature:o,view:n,zoomFactor:a}=t,s=d(t);if(!s){const t=new e("zoom-to:invalid-target-or-view","Cannot zoom to location without a target and view.",{target:s,view:n});throw c.error(t),t}const u=n.scale/a,l=t.get("selectedFeature.geometry")||r,w=l&&"point"===l.type&&await g(o,n);i.active=!0,i.disabled=!0;try{await t.view.goTo({target:s,scale:w?u:void 0})}catch(p){const t=new e("zoom-to:invalid-graphic","Could not zoom to the location of the graphic.",{graphic:o});c.error(t)}finally{i.active=!1,i.disabled=!1,t.zoomToLocation=null,w&&(t.location=l)}}async function p(t){const{selectedFeature:r,view:i}=t;if("2d"!==i?.type){const t=new e("zoomToCluster:invalid-view","View must be 2d MapView.",{view:i});throw c.error(t),t}if(!l(r)){const t=new e("zoomToCluster:invalid-selectedFeature","Selected feature must represent an aggregate/cluster graphic.",{selectedFeature:r});throw c.error(t),t}const n=r.sourceLayer,a=await i.whenLayerView(n),s=a.createQuery();s.aggregateIds=[r.getObjectId()],o.active=!0,o.disabled=!0;const{extent:u}=await a.queryExtent(s);await i.goTo({target:u}),o.active=!1,o.disabled=!1}async function f(e){const{selectedFeature:t,view:r}=e,i=t.sourceLayer,o=await r.whenLayerView(i),n=o.createQuery();n.aggregateIds=[t.getObjectId()];const{extent:a}=await o.queryExtent(n);e.selectedClusterBoundaryFeature.geometry=a,r.graphics.add(e.selectedClusterBoundaryFeature)}async function v(e){const{selectedFeature:t,view:r}=e,i=t.sourceLayer,o=await r.whenLayerView(i),a=o.createQuery();a.aggregateIds=[t.getObjectId()],n.active=!0,n.disabled=!0;const{features:s}=await o.queryFeatures(a);n.active=!1,n.disabled=!1,r.popup.open({features:[t].concat(s),featureMenuOpen:!0})}function m(e){const t=e.features.filter((e=>l(e)));t.length&&(e.features=t)}export{v as browseAggregateFeatures,f as displayClusterExtent,d as getSelectedTarget,l as isClusterFeature,m as removeClusteredFeaturesForBrowsing,u as triggerAction,p as zoomToClusterExtent,w as zoomToLocation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{closest as l}from"../core/domUtils.js";import{on as t,eventKey as s}from"../core/events.js";import{HandleOwnerMixin as a}from"../core/HandleOwner.js";import{watch as i,when as n,initial as c}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as o}from"../core/accessorSupport/decorators/cast.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import u from"./Slider.js";import m from"./Widget.js";import{getScalePreviewSource as h,getScalePreviewSpriteBackgroundPosition as v}from"./ScaleRangeSlider/scalePreviewUtils.js";import p from"./ScaleRangeSlider/ScaleRanges.js";import _ from"./ScaleRangeSlider/ScaleRangeSliderViewModel.js";import S from"./support/Popover.js";import{accessibleHandler as M}from"./support/decorators/accessibleHandler.js";import{messageBundle as g}from"./support/decorators/messageBundle.js";import{tsx as b}from"./support/jsxFactory.js";import{isRTL as f,storeNode as w}from"./support/widgetUtils.js";import{formatNumber as y}from"../intl/number.js";import{substitute as x}from"../intl/substitute.js";const I={base:"esri-scale-range-slider",scaleIndicator:"esri-scale-range-slider__scale-indicator",scaleIndicatorIcon:"esri-scale-range-slider__scale-indicator-icon",scaleIndicatorContainer:"esri-scale-range-slider__scale-indicator-container",scaleMenuContainer:"esri-scale-range-slider__scale-menu-container",scaleMenuToggle:"esri-scale-range-slider__scale-menu-toggle",scaleMenuToggleText:"esri-scale-range-slider__scale-menu-toggle-text",scaleMenuToggleIcon:"esri-scale-range-slider__scale-menu-toggle-icon",scaleMenuToggleActive:"esri-scale-range-slider__scale-menu-toggle--active",scaleMenu:"esri-scale-range-slider__scale-menu",scaleMenuList:"esri-scale-range-slider__scale-menu-list",scaleMenuListItem:"esri-scale-range-slider__scale-menu-item",scaleMenuListItemActive:"esri-scale-range-slider__scale-menu-item--active",scaleMenuScroller:"esri-scale-range-slider__scale-menu-scroller",scaleItemLabel:"esri-scale-range-slider__scale-item-label",scaleItemValue:"esri-scale-range-slider__scale-item-value",scaleItemValueEditable:"esri-scale-range-slider__scale-item-value--editable",scalePreview:"esri-scale-range-slider__scale-preview",scalePreviewThumbnail:"esri-scale-range-slider__scale-preview-thumbnail",slider:"esri-slider",expandIcon:"esri-icon-down",heading:"esri-widget__heading",hidden:"esri-hidden",input:"esri-input",button:"esri-button",disabled:"esri-disabled",widget:"esri-widget"},T={preview:!0,scaleMenus:{maxScaleMenu:!0,minScaleMenu:!0}},C={maximumFractionDigits:0},R=e=>`1:${y(e,C)}`,L=e=>{const l=/[^\d.\s]/g,t=e.replace(/.*\(/,"").replace(/\).*$/,"").replace(/.*:/,"").replace(l,"");return parseFloat(t)};let P=class extends(a(m)){constructor(e,a){super(e,a),this._activeMenu=null,this._activeMenuNode=null,this._activeMenuToggleNode=null,this._activeThumb=null,this._customMaxScale=-1,this._customMinScale=-1,this._focusedMenuItemIndex=-1,this._maxScaleMenuPopover=new S({owner:this,placement:"bottom-end",anchorElement:()=>this._activeMenuToggleNode,renderContentFunction:()=>this._maxScaleMenuEnabled?this.renderMaxScaleMenu():null}),this._minScaleMenuPopover=new S({owner:this,placement:"bottom-start",anchorElement:()=>this._activeMenuToggleNode,renderContentFunction:()=>this._minScaleMenuEnabled?this.renderMinScaleMenu():null}),this._previewAutoCloseTimeoutId=null,this._previewPopover=new S({owner:this,placement:"top",anchorElement:()=>0===this._activeThumb?this._minThumbNode:this._maxThumbNode,offset:[0,16],renderContentFunction:this.renderScalePreview}),this._scaleMenuNode=null,this._slider=new u({thumbCreatedFunction:(e,l,s)=>{0===e&&(this._minThumbNode=s),1===e&&(this._maxThumbNode=s),this.addHandles([t(s,"mouseenter",(()=>{const{visibleElements:{preview:l}}=this;this._activeThumb=e,this._previewPopover.open=l,this.scheduleRender()})),t(s,"mouseleave",(()=>{this._previewAutoCloseTimeoutId||(this._activeThumb=null,this._previewPopover.open=!1,this.scheduleRender())}))])}}),this.disabled=!1,this.effectiveMaxScale=null,this.effectiveMinScale=null,this.label=void 0,this.layer=null,this.maxScale=null,this.maxScaleLimit=null,this.messages=null,this.minScale=null,this.minScaleLimit=null,this.region="US",this.view=null,this.viewModel=new _,this.visibleElements=T,this._handleScaleMenuToggleClick=e=>{const s=e.currentTarget,a=s.getAttribute("data-type"),i="menu-closing-click-handle";if(this.handles.remove(i),a===this._activeMenu)return this._setActiveMenu(null),void(this._activeMenuToggleNode=null);this._setActiveMenu(a),this._activeMenuToggleNode=s,this.handles.add(t(document,"mousedown",(e=>{const t=e.target,s=l(t,`.${I.scaleMenuToggle}`),a=s&&s.getAttribute("data-type");if(s&&a===this._activeMenu)return;!a&&this._scaleMenuNode&&!this._scaleMenuNode.contains(t)&&(this._setActiveMenu(null),this.handles.remove(i),this.scheduleRender())})),i)},this._afterMenuListCreate=e=>{this._activeMenuNode=e,e.children[0].focus({preventScroll:!0})},this._handleCustomScaleEntry=e=>{this._setScaleFromMenuSelection(e),this._customMaxScale=-1,this._customMinScale=-1},this._handleCustomScaleInputBlur=()=>{"max"===this._activeMenu?this._customMaxScale=-1:this._customMinScale=-1},this._handleCustomScaleInputKeyDown=e=>{const l=e.currentTarget,{handleCustomScaleSelect:t}=l["data-render-props"],{key:s,ctrlKey:a,metaKey:i}=e,{viewModel:{scaleRanges:n}}=this;if("Enter"===s){const s=L(l.value);return t(isNaN(s)?-1:n.clampScale(s)),e.preventDefault(),void e.stopPropagation()}if(s.length>1||a||i)return;/[:,.\d]/.test(s)||(e.preventDefault(),e.stopPropagation())},this._handleScaleMenuKeyDown=e=>{const l=s(e);if("Escape"===l||"Tab"===l)return this._setActiveMenu(null),void this._activeMenuToggleNode.focus();if("ArrowUp"!==l&&"ArrowDown"!==l)return;const t=this._activeMenuNode.children,a=this._focusedMenuItemIndex,i="ArrowUp"===l?(0===a?t.length:a)-1:(a+1)%t.length;e.preventDefault(),e.stopPropagation(),t[i].focus(),this._focusedMenuItemIndex=i}}initialize(){this.addHandles([i((()=>this.viewModel),(e=>this._slider.viewModel=e?e.sliderViewModel:null),c),i((()=>this._interactive),(e=>{this._slider.disabled=!e,e||this._setActiveMenu(null)}),c),this._slider.on("thumb-drag",(({index:e})=>{const{visibleElements:{preview:l}}=this;this._activeThumb=e,this._previewPopover.open=l,clearTimeout(this._previewAutoCloseTimeoutId);const t=250;this._previewAutoCloseTimeoutId=setTimeout((()=>{this._previewAutoCloseTimeoutId=null,this._activeThumb=null,this._previewPopover.open=!1,this.scheduleRender()}),t)})),n((()=>!0===this.view?.stationary),(()=>this.scheduleRender()))])}destroy(){this._previewPopover.destroy(),this._previewPopover=null,this._maxScaleMenuPopover.destroy(),this._maxScaleMenuPopover=null,this._minScaleMenuPopover.destroy(),this._minScaleMenuPopover=null,this._slider.destroy(),this._slider=null}get _maxScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&e.maxScaleMenu}get _minScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&e.minScaleMenu}get _interactive(){return"disabled"!==this.get("viewModel.state")&&!this.disabled}castVisibleElements(e){return{...T,...e,scaleMenus:"boolean"==typeof e?.scaleMenus?e.scaleMenus:{...T.scaleMenus,...e?.scaleMenus}}}render(){const{_interactive:e,_slider:l,label:t,messages:s,view:a,viewModel:{scaleRanges:i,state:n}}=this,c=s.scaleRangeLabels[i.findScaleRangeByIndex(l.values[0]).id],r=s.scaleRangeLabels[i.findScaleRangeByIndex(l.values[1]).id];return l.layout=f(this.container)?"horizontal-reversed":"horizontal",b("div",{"aria-label":t,class:this.classes(I.base,I.widget,e?null:I.disabled)},"ready"===n&&a?this.renderCurrentScaleIndicator():null,l.render(),b("div",{class:I.scaleMenuContainer,key:"scale-menu-toggles"},this._minScaleMenuEnabled?this.renderScaleMenuToggle("min",c):null,this._maxScaleMenuEnabled?this.renderScaleMenuToggle("max",r):null))}renderMinScaleMenu(){const{effectiveMaxScale:e,minScaleLimit:l,view:t,viewModel:{scaleRanges:s}}=this,a=t?t.scale:void 0;return this.renderScaleMenu({type:"min",min:l,max:s.findScaleRange(e).minScale,map:a})}renderMaxScaleMenu(){const{effectiveMinScale:e,maxScaleLimit:l,view:t,viewModel:{scaleRanges:s}}=this,a=t?t.scale:void 0;return this.renderScaleMenu({type:"max",min:s.findScaleRange(e).maxScale,max:l,map:a})}renderScalePreview(){const{_activeThumb:e,_slider:l,region:t,viewModel:{scaleRanges:s}}=this,a=0===e?l.values[0]:l.values[1],i=Object.keys(p.RecommendedScales).indexOf(s.findScaleRangeByIndex(a).id),n={backgroundImage:h(t),backgroundPosition:v(i)};return b("div",{class:I.scalePreview},b("div",{class:I.scalePreviewThumbnail,styles:n}))}renderScaleMenu({map:e,min:l,max:t,type:s}){const a=p.fromScaleRange({minScale:l,maxScale:t}),i=this.messages.featuredScaleLabels,n=p.RecommendedScales,c=Object.keys(n).filter((e=>a.contains(n[e]))).map((e=>this.renderScaleMenuItem({scaleLabel:i[e],scaleValue:n[e],valueVisible:"world"!==e,handleNamedScaleSelect:this._handleRecommendedScaleClick}))),{_customMaxScale:r,_customMinScale:o,messages:d}=this,u="max"===s?r:o;return b("div",{bind:this,class:I.scaleMenu,"data-type":s,id:`${this.id}__scale-menu--${s}`,key:`${s}-scale-menu`,afterCreate:w,"data-node-ref":"_scaleMenuNode",onkeydown:this._handleScaleMenuKeyDown},b("div",{class:I.scaleMenuScroller},b("ul",{class:I.scaleMenuList,afterCreate:this._afterMenuListCreate},this.renderScaleMenuItem({scaleValue:u,scaleLabel:d.featuredScaleLabels.custom,valueVisible:!1,handleNamedScaleSelect:this._handleScaleSelection,handleCustomScaleSelect:this._handleCustomScaleEntry}),null!=e?this.renderScaleMenuItem({scaleValue:e,scaleLabel:d.featuredScaleLabels.current,valueVisible:!0,handleNamedScaleSelect:this._handleRecommendedScaleClick}):null,c)))}_handleScaleSelection(){"max"===this._activeMenu?this._customMaxScale=this.effectiveMaxScale:this._customMinScale=this.effectiveMinScale}renderScaleMenuToggle(e,l){const{_activeMenu:t,_interactive:s}=this,a=t===e;return b("button",{"aria-controls":a?`${this.id}__scale-menu--${e}`:"","aria-pressed":a?"true":"false",class:this.classes(I.scaleMenuToggle,a?I.scaleMenuToggleActive:null),"data-type":e,key:`${e}-scale-menu-toggle`,onclick:this._handleScaleMenuToggleClick,disabled:!s,type:"button"},b("div",{class:I.scaleMenuToggleText,"aria-label":l,title:l},l),b("span",{class:this.classes(I.scaleMenuToggleIcon,I.expandIcon),"aria-hidden":"true"}))}renderScaleMenuItem(e){const{scaleValue:l,scaleLabel:t,valueVisible:s,handleNamedScaleSelect:a,handleCustomScaleSelect:i=null}=e,{id:n}=this,c=`${n}__custom-scale-input`;return b("li",{bind:this,class:I.scaleMenuListItem,"data-scale":l,key:t,onclick:a,onkeydown:a,tabIndex:-1},b("label",{class:I.scaleItemLabel,for:c},t),l>-1?i?b("input",{afterCreate:this._focusAndSelectInputOnCreate,class:this.classes(I.scaleItemValue,I.scaleItemValueEditable),"data-render-props":e,id:c,key:"value",value:R(l),onkeydown:this._handleCustomScaleInputKeyDown,onblur:this._handleCustomScaleInputBlur}):s?b("div",{class:I.scaleItemValue,key:"value"},R(l)):null:null)}_focusAndSelectInputOnCreate(e){e.focus(),e.select()}renderCurrentScaleIndicator(){const{_slider:e,messages:l,view:t,viewModel:{scaleRanges:s}}=this,a=s.clampScale(t.scale),i=this.viewModel.mapScaleToSlider(a),n=i/e.max,c=l.scaleRangeLabels[s.findScaleRangeByIndex(i).id],r=x(l.currentScaleTooltip,{scaleLabel:c});return b("div",{class:I.scaleIndicatorContainer,key:"scale-indicator"},b("div",{"aria-label":r,class:I.scaleIndicator,styles:{left:(f(this.container)?-1:1)*n*100+"%"},title:r},this.renderCurrentScaleIndicatorIcon()))}renderCurrentScaleIndicatorIcon(){return b("svg",{class:I.scaleIndicatorIcon,height:"8",width:"8",viewBox:"0 0 8 8",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},b("polygon",{points:"4 0 8 8 0 8"}))}_handleRecommendedScaleClick(e){const l=e.currentTarget,t=Number(l["data-scale"]);this._setScaleFromMenuSelection(t)}_setScaleFromMenuSelection(e){"max"===this._activeMenu?this.maxScale=Math.min(e,this.effectiveMinScale-1):this.minScale=Math.max(e,this.effectiveMaxScale+1),this._setActiveMenu(null),this._activeMenuToggleNode.focus()}_setActiveMenu(e){this._activeMenu=e,this._maxScaleMenuPopover.open="max"===e,this._minScaleMenuPopover.open="min"===e,this._focusedMenuItemIndex=e?0:-1}};e([r()],P.prototype,"_maxScaleMenuEnabled",null),e([r()],P.prototype,"_minScaleMenuEnabled",null),e([r()],P.prototype,"_slider",void 0),e([r({readOnly:!0})],P.prototype,"_interactive",null),e([r()],P.prototype,"disabled",void 0),e([r({aliasOf:"viewModel.effectiveMaxScale"})],P.prototype,"effectiveMaxScale",void 0),e([r({aliasOf:"viewModel.effectiveMinScale"})],P.prototype,"effectiveMinScale",void 0),e([r({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],P.prototype,"label",void 0),e([r({aliasOf:"viewModel.layer"})],P.prototype,"layer",void 0),e([r({aliasOf:"viewModel.maxScale"})],P.prototype,"maxScale",void 0),e([r({aliasOf:"viewModel.maxScaleLimit"})],P.prototype,"maxScaleLimit",void 0),e([r(),g("esri/widgets/ScaleRangeSlider/t9n/ScaleRangeSlider")],P.prototype,"messages",void 0),e([r({aliasOf:"viewModel.minScale"})],P.prototype,"minScale",void 0),e([r({aliasOf:"viewModel.minScaleLimit"})],P.prototype,"minScaleLimit",void 0),e([r()],P.prototype,"region",void 0),e([r({aliasOf:"viewModel.view"})],P.prototype,"view",void 0),e([r()],P.prototype,"viewModel",void 0),e([r()],P.prototype,"visibleElements",void 0),e([o("visibleElements")],P.prototype,"castVisibleElements",null),e([M()],P.prototype,"_handleScaleSelection",null),e([M()],P.prototype,"_handleRecommendedScaleClick",null),P=e([d("esri.widgets.ScaleRangeSlider")],P);const j=P;export{j as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{closest as l}from"../core/domUtils.js";import{on as t,eventKey as s}from"../core/events.js";import{HandleOwnerMixin as a}from"../core/HandleOwner.js";import{watch as i,when as n,initial as c}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as o}from"../core/accessorSupport/decorators/cast.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import u from"./Slider.js";import m from"./Widget.js";import{getScalePreviewSource as h,getScalePreviewSpriteBackgroundPosition as v}from"./ScaleRangeSlider/scalePreviewUtils.js";import p from"./ScaleRangeSlider/ScaleRanges.js";import _ from"./ScaleRangeSlider/ScaleRangeSliderViewModel.js";import S from"./support/Popover.js";import{accessibleHandler as M}from"./support/decorators/accessibleHandler.js";import{messageBundle as g}from"./support/decorators/messageBundle.js";import{tsx as b}from"./support/jsxFactory.js";import{isRTL as f,storeNode as w}from"./support/widgetUtils.js";import{substitute as y}from"../intl/substitute.js";import{formatNumber as x}from"../intl/number.js";const I={base:"esri-scale-range-slider",scaleIndicator:"esri-scale-range-slider__scale-indicator",scaleIndicatorIcon:"esri-scale-range-slider__scale-indicator-icon",scaleIndicatorContainer:"esri-scale-range-slider__scale-indicator-container",scaleMenuContainer:"esri-scale-range-slider__scale-menu-container",scaleMenuToggle:"esri-scale-range-slider__scale-menu-toggle",scaleMenuToggleText:"esri-scale-range-slider__scale-menu-toggle-text",scaleMenuToggleIcon:"esri-scale-range-slider__scale-menu-toggle-icon",scaleMenuToggleActive:"esri-scale-range-slider__scale-menu-toggle--active",scaleMenu:"esri-scale-range-slider__scale-menu",scaleMenuList:"esri-scale-range-slider__scale-menu-list",scaleMenuListItem:"esri-scale-range-slider__scale-menu-item",scaleMenuListItemActive:"esri-scale-range-slider__scale-menu-item--active",scaleMenuScroller:"esri-scale-range-slider__scale-menu-scroller",scaleItemLabel:"esri-scale-range-slider__scale-item-label",scaleItemValue:"esri-scale-range-slider__scale-item-value",scaleItemValueEditable:"esri-scale-range-slider__scale-item-value--editable",scalePreview:"esri-scale-range-slider__scale-preview",scalePreviewThumbnail:"esri-scale-range-slider__scale-preview-thumbnail",slider:"esri-slider",expandIcon:"esri-icon-down",heading:"esri-widget__heading",hidden:"esri-hidden",input:"esri-input",button:"esri-button",disabled:"esri-disabled",widget:"esri-widget"},T={preview:!0,scaleMenus:{maxScaleMenu:!0,minScaleMenu:!0}},C={maximumFractionDigits:0},R=e=>`1:${x(e,C)}`,L=e=>{const l=/[^\d.\s]/g,t=e.replace(/.*\(/,"").replace(/\).*$/,"").replace(/.*:/,"").replace(l,"");return parseFloat(t)};let P=class extends(a(m)){constructor(e,a){super(e,a),this._activeMenu=null,this._activeMenuNode=null,this._activeMenuToggleNode=null,this._activeThumb=null,this._customMaxScale=-1,this._customMinScale=-1,this._focusedMenuItemIndex=-1,this._maxScaleMenuPopover=new S({owner:this,placement:"bottom-end",anchorElement:()=>this._activeMenuToggleNode,renderContentFunction:()=>this._maxScaleMenuEnabled?this.renderMaxScaleMenu():null}),this._minScaleMenuPopover=new S({owner:this,placement:"bottom-start",anchorElement:()=>this._activeMenuToggleNode,renderContentFunction:()=>this._minScaleMenuEnabled?this.renderMinScaleMenu():null}),this._previewAutoCloseTimeoutId=null,this._previewPopover=new S({owner:this,placement:"top",anchorElement:()=>0===this._activeThumb?this._minThumbNode:this._maxThumbNode,offset:[0,16],renderContentFunction:this.renderScalePreview}),this._scaleMenuNode=null,this._slider=new u({thumbCreatedFunction:(e,l,s)=>{0===e&&(this._minThumbNode=s),1===e&&(this._maxThumbNode=s),this.addHandles([t(s,"mouseenter",(()=>{const{visibleElements:{preview:l}}=this;this._activeThumb=e,this._previewPopover.open=l,this.scheduleRender()})),t(s,"mouseleave",(()=>{this._previewAutoCloseTimeoutId||(this._activeThumb=null,this._previewPopover.open=!1,this.scheduleRender())}))])}}),this.disabled=!1,this.effectiveMaxScale=null,this.effectiveMinScale=null,this.label=void 0,this.layer=null,this.maxScale=null,this.maxScaleLimit=null,this.messages=null,this.minScale=null,this.minScaleLimit=null,this.region="US",this.view=null,this.viewModel=new _,this.visibleElements=T,this._handleScaleMenuToggleClick=e=>{const s=e.currentTarget,a=s.getAttribute("data-type"),i="menu-closing-click-handle";if(this.handles.remove(i),a===this._activeMenu)return this._setActiveMenu(null),void(this._activeMenuToggleNode=null);this._setActiveMenu(a),this._activeMenuToggleNode=s,this.handles.add(t(document,"mousedown",(e=>{const t=e.target,s=l(t,`.${I.scaleMenuToggle}`),a=s&&s.getAttribute("data-type");if(s&&a===this._activeMenu)return;!a&&this._scaleMenuNode&&!this._scaleMenuNode.contains(t)&&(this._setActiveMenu(null),this.handles.remove(i),this.scheduleRender())})),i)},this._afterMenuListCreate=e=>{this._activeMenuNode=e,e.children[0].focus({preventScroll:!0})},this._handleCustomScaleEntry=e=>{this._setScaleFromMenuSelection(e),this._customMaxScale=-1,this._customMinScale=-1},this._handleCustomScaleInputBlur=()=>{"max"===this._activeMenu?this._customMaxScale=-1:this._customMinScale=-1},this._handleCustomScaleInputKeyDown=e=>{const l=e.currentTarget,{handleCustomScaleSelect:t}=l["data-render-props"],{key:s,ctrlKey:a,metaKey:i}=e,{viewModel:{scaleRanges:n}}=this;if("Enter"===s){const s=L(l.value);return t(isNaN(s)?-1:n.clampScale(s)),e.preventDefault(),void e.stopPropagation()}if(s.length>1||a||i)return;/[:,.\d]/.test(s)||(e.preventDefault(),e.stopPropagation())},this._handleScaleMenuKeyDown=e=>{const l=s(e);if("Escape"===l||"Tab"===l)return this._setActiveMenu(null),void this._activeMenuToggleNode.focus();if("ArrowUp"!==l&&"ArrowDown"!==l)return;const t=this._activeMenuNode.children,a=this._focusedMenuItemIndex,i="ArrowUp"===l?(0===a?t.length:a)-1:(a+1)%t.length;e.preventDefault(),e.stopPropagation(),t[i].focus(),this._focusedMenuItemIndex=i}}initialize(){this.addHandles([i((()=>this.viewModel),(e=>this._slider.viewModel=e?e.sliderViewModel:null),c),i((()=>this._interactive),(e=>{this._slider.disabled=!e,e||this._setActiveMenu(null)}),c),this._slider.on("thumb-drag",(({index:e})=>{const{visibleElements:{preview:l}}=this;this._activeThumb=e,this._previewPopover.open=l,clearTimeout(this._previewAutoCloseTimeoutId);const t=250;this._previewAutoCloseTimeoutId=setTimeout((()=>{this._previewAutoCloseTimeoutId=null,this._activeThumb=null,this._previewPopover.open=!1,this.scheduleRender()}),t)})),n((()=>!0===this.view?.stationary),(()=>this.scheduleRender()))])}destroy(){this._previewPopover.destroy(),this._previewPopover=null,this._maxScaleMenuPopover.destroy(),this._maxScaleMenuPopover=null,this._minScaleMenuPopover.destroy(),this._minScaleMenuPopover=null,this._slider.destroy(),this._slider=null}get _maxScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&e.maxScaleMenu}get _minScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&e.minScaleMenu}get _interactive(){return"disabled"!==this.get("viewModel.state")&&!this.disabled}castVisibleElements(e){return{...T,...e,scaleMenus:"boolean"==typeof e?.scaleMenus?e.scaleMenus:{...T.scaleMenus,...e?.scaleMenus}}}render(){const{_interactive:e,_slider:l,label:t,messages:s,view:a,viewModel:{scaleRanges:i,state:n}}=this,c=s.scaleRangeLabels[i.findScaleRangeByIndex(l.values[0]).id],r=s.scaleRangeLabels[i.findScaleRangeByIndex(l.values[1]).id];return l.layout=f(this.container)?"horizontal-reversed":"horizontal",b("div",{"aria-label":t,class:this.classes(I.base,I.widget,e?null:I.disabled)},"ready"===n&&a?this.renderCurrentScaleIndicator():null,l.render(),b("div",{class:I.scaleMenuContainer,key:"scale-menu-toggles"},this._minScaleMenuEnabled?this.renderScaleMenuToggle("min",c):null,this._maxScaleMenuEnabled?this.renderScaleMenuToggle("max",r):null))}renderMinScaleMenu(){const{effectiveMaxScale:e,minScaleLimit:l,view:t,viewModel:{scaleRanges:s}}=this,a=t?t.scale:void 0;return this.renderScaleMenu({type:"min",min:l,max:s.findScaleRange(e).minScale,map:a})}renderMaxScaleMenu(){const{effectiveMinScale:e,maxScaleLimit:l,view:t,viewModel:{scaleRanges:s}}=this,a=t?t.scale:void 0;return this.renderScaleMenu({type:"max",min:s.findScaleRange(e).maxScale,max:l,map:a})}renderScalePreview(){const{_activeThumb:e,_slider:l,region:t,viewModel:{scaleRanges:s}}=this,a=0===e?l.values[0]:l.values[1],i=Object.keys(p.RecommendedScales).indexOf(s.findScaleRangeByIndex(a).id),n={backgroundImage:h(t),backgroundPosition:v(i)};return b("div",{class:I.scalePreview},b("div",{class:I.scalePreviewThumbnail,styles:n}))}renderScaleMenu({map:e,min:l,max:t,type:s}){const a=p.fromScaleRange({minScale:l,maxScale:t}),i=this.messages.featuredScaleLabels,n=p.RecommendedScales,c=Object.keys(n).filter((e=>a.contains(n[e]))).map((e=>this.renderScaleMenuItem({scaleLabel:i[e],scaleValue:n[e],valueVisible:"world"!==e,handleNamedScaleSelect:this._handleRecommendedScaleClick}))),{_customMaxScale:r,_customMinScale:o,messages:d}=this,u="max"===s?r:o;return b("div",{bind:this,class:I.scaleMenu,"data-type":s,id:`${this.id}__scale-menu--${s}`,key:`${s}-scale-menu`,afterCreate:w,"data-node-ref":"_scaleMenuNode",onkeydown:this._handleScaleMenuKeyDown},b("div",{class:I.scaleMenuScroller},b("ul",{class:I.scaleMenuList,afterCreate:this._afterMenuListCreate},this.renderScaleMenuItem({scaleValue:u,scaleLabel:d.featuredScaleLabels.custom,valueVisible:!1,handleNamedScaleSelect:this._handleScaleSelection,handleCustomScaleSelect:this._handleCustomScaleEntry}),null!=e?this.renderScaleMenuItem({scaleValue:e,scaleLabel:d.featuredScaleLabels.current,valueVisible:!0,handleNamedScaleSelect:this._handleRecommendedScaleClick}):null,c)))}_handleScaleSelection(){"max"===this._activeMenu?this._customMaxScale=this.effectiveMaxScale:this._customMinScale=this.effectiveMinScale}renderScaleMenuToggle(e,l){const{_activeMenu:t,_interactive:s}=this,a=t===e;return b("button",{"aria-controls":a?`${this.id}__scale-menu--${e}`:"","aria-pressed":a?"true":"false",class:this.classes(I.scaleMenuToggle,a?I.scaleMenuToggleActive:null),"data-type":e,key:`${e}-scale-menu-toggle`,onclick:this._handleScaleMenuToggleClick,disabled:!s,type:"button"},b("div",{class:I.scaleMenuToggleText,"aria-label":l,title:l},l),b("span",{class:this.classes(I.scaleMenuToggleIcon,I.expandIcon),"aria-hidden":"true"}))}renderScaleMenuItem(e){const{scaleValue:l,scaleLabel:t,valueVisible:s,handleNamedScaleSelect:a,handleCustomScaleSelect:i=null}=e,{id:n}=this,c=`${n}__custom-scale-input`;return b("li",{bind:this,class:I.scaleMenuListItem,"data-scale":l,key:t,onclick:a,onkeydown:a,tabIndex:-1},b("label",{class:I.scaleItemLabel,for:c},t),l>-1?i?b("input",{afterCreate:this._focusAndSelectInputOnCreate,class:this.classes(I.scaleItemValue,I.scaleItemValueEditable),"data-render-props":e,id:c,key:"value",value:R(l),onkeydown:this._handleCustomScaleInputKeyDown,onblur:this._handleCustomScaleInputBlur}):s?b("div",{class:I.scaleItemValue,key:"value"},R(l)):null:null)}_focusAndSelectInputOnCreate(e){e.focus(),e.select()}renderCurrentScaleIndicator(){const{_slider:e,messages:l,view:t,viewModel:{scaleRanges:s}}=this,a=s.clampScale(t.scale),i=this.viewModel.mapScaleToSlider(a),n=i/e.max,c=l.scaleRangeLabels[s.findScaleRangeByIndex(i).id],r=y(l.currentScaleTooltip,{scaleLabel:c});return b("div",{class:I.scaleIndicatorContainer,key:"scale-indicator"},b("div",{"aria-label":r,class:I.scaleIndicator,styles:{left:(f(this.container)?-1:1)*n*100+"%"},title:r},this.renderCurrentScaleIndicatorIcon()))}renderCurrentScaleIndicatorIcon(){return b("svg",{class:I.scaleIndicatorIcon,height:"8",width:"8",viewBox:"0 0 8 8",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},b("polygon",{points:"4 0 8 8 0 8"}))}_handleRecommendedScaleClick(e){const l=e.currentTarget,t=Number(l["data-scale"]);this._setScaleFromMenuSelection(t)}_setScaleFromMenuSelection(e){"max"===this._activeMenu?this.maxScale=Math.min(e,this.effectiveMinScale-1):this.minScale=Math.max(e,this.effectiveMaxScale+1),this._setActiveMenu(null),this._activeMenuToggleNode.focus()}_setActiveMenu(e){this._activeMenu=e,this._maxScaleMenuPopover.open="max"===e,this._minScaleMenuPopover.open="min"===e,this._focusedMenuItemIndex=e?0:-1}};e([r()],P.prototype,"_maxScaleMenuEnabled",null),e([r()],P.prototype,"_minScaleMenuEnabled",null),e([r()],P.prototype,"_slider",void 0),e([r({readOnly:!0})],P.prototype,"_interactive",null),e([r()],P.prototype,"disabled",void 0),e([r({aliasOf:"viewModel.effectiveMaxScale"})],P.prototype,"effectiveMaxScale",void 0),e([r({aliasOf:"viewModel.effectiveMinScale"})],P.prototype,"effectiveMinScale",void 0),e([r({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],P.prototype,"label",void 0),e([r({aliasOf:"viewModel.layer"})],P.prototype,"layer",void 0),e([r({aliasOf:"viewModel.maxScale"})],P.prototype,"maxScale",void 0),e([r({aliasOf:"viewModel.maxScaleLimit"})],P.prototype,"maxScaleLimit",void 0),e([r(),g("esri/widgets/ScaleRangeSlider/t9n/ScaleRangeSlider")],P.prototype,"messages",void 0),e([r({aliasOf:"viewModel.minScale"})],P.prototype,"minScale",void 0),e([r({aliasOf:"viewModel.minScaleLimit"})],P.prototype,"minScaleLimit",void 0),e([r()],P.prototype,"region",void 0),e([r({aliasOf:"viewModel.view"})],P.prototype,"view",void 0),e([r()],P.prototype,"viewModel",void 0),e([r()],P.prototype,"visibleElements",void 0),e([o("visibleElements")],P.prototype,"castVisibleElements",null),e([M()],P.prototype,"_handleScaleSelection",null),e([M()],P.prototype,"_handleRecommendedScaleClick",null),P=e([d("esri.widgets.ScaleRangeSlider")],P);const j=P;export{j 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/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import i from"../../core/Error.js";import s from"../../core/Logger.js";import{
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import i from"../../core/Error.js";import s from"../../core/Logger.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";let n=class extends e{constructor(t){super(t),this.precision=4,this.thumbsConstrained=!0}set effectiveMax(t){this.setEffectiveMax(t)}set effectiveMin(t){this.setEffectiveMin(t)}set labelFormatFunction(t){this._set("labelFormatFunction",t)}set inputFormatFunction(t){this._set("inputFormatFunction",t)}set inputParseFunction(t){this._set("inputParseFunction",t)}get labels(){const{max:t,min:e,values:i}=this,s=i&&i.length?i.map(((t,e)=>this.getLabelForValue(t,"value",e))):[];return{max:this.getLabelForValue(t,"max"),min:this.getLabelForValue(e,"min"),values:s}}set max(t){this.setMax(t)}set min(t){this.setMin(t)}get state(){const{max:t,min:e}=this;return null!=t&&null!=e&&t>e?"ready":"disabled"}set values(t){const{max:e,min:i}=this,s=this.values;s&&t&&s.length===t.length&&s.every(((e,i)=>e===t[i]))||(this._set("values",null),t&&t.length&&(null!=i&&t.some((t=>t<i))&&(this.min=Math.min(...t)),null!=e&&t.some((t=>t>e))&&(this.max=Math.max(...t))),this._set("values",t))}toPrecision(t){return parseFloat(t.toFixed(this.precision))}defaultLabelFormatFunction(t){const{max:e,min:i,precision:s}=this,r=null!=e&&null!=i&&e-i>10?2:s;return parseFloat(t.toFixed(r)).toString()}defaultInputFormatFunction(t){return t.toString()}defaultInputParseFunction(t){return parseFloat(t)}getBounds(){const{effectiveMax:t,effectiveMin:e,max:i,min:s}=this;return{min:null!=e&&null!=s?Math.max(s,e):s,max:null!=t&&null!=i?Math.min(i,t):i}}getBoundsForValueAtIndex(t){const{thumbsConstrained:e,values:i}=this,{min:s,max:r}=this.getBounds();if(e&&i){const e=t-1,o=t+1;return{min:null!=i[e]?i[e]:s,max:null!=i[o]?i[o]:r}}return{min:s,max:r}}getLabelForValue(t,e,i){return null==t?null:this.labelFormatFunction?this.labelFormatFunction(t,e,i):this.defaultLabelFormatFunction(t)}setMax(t){const{max:e,values:i}=this;if(null==t)return void this._set("max",null);if(isNaN(t))return void this._logError("slider:invalid-value","Supplied value for property 'max' is NaN.");const s=this.toPrecision(t);if(e!==s&&(this._set("max",s),i&&i.length))for(let r=0;r<i.length;r++)s<i[r]&&this.setValue(r,s)}setMin(t){const{min:e,values:i}=this;if(null==t)return void this._set("min",null);if(isNaN(t))return void this._logError("slider:invalid-value","Supplied value for property 'min' is NaN.");const s=this.toPrecision(t);if(e!==s&&(this._set("min",s),i&&i.length))for(let r=0;r<i.length;r++)s>i[r]&&this.setValue(r,s)}setEffectiveMax(t){if(null==t)return void this._set("effectiveMax",null);if(isNaN(t))return void this._logError("slider:invalid-value","Supplied value for property 'effectiveMax' is NaN.");const e=this.toPrecision(t);this.effectiveMax!==e&&this._set("effectiveMax",this._applyBoundsToValue(e))}setEffectiveMin(t){if(null==t)return void this._set("effectiveMin",null);if(isNaN(t))return void this._logError("slider:invalid-value","Supplied value for property 'effectiveMin' is NaN.");const e=this.toPrecision(t);this.effectiveMin!==e&&this._set("effectiveMin",this._applyBoundsToValue(e))}setValue(t,e){if(isNaN(e))return void this._logError("slider:invalid-value","Supplied value for member of property 'values' is NaN.");const{values:i}=this;if(null==i)return void this._logError("slider:invalid-value","Supplied value for member of property 'values' is null.");const s=i[t],r=this.toPrecision(e);if(s===r)return;const o=[...i];o[t]=r,this._set("values",o),this.notifyChange("labels")}_applyBoundsToValue(t){const{max:e,min:i}=this;return null!=i&&t<i?i:null!=e&&t>e?e:t}_logError(t,e,r){s.getLogger(this.declaredClass).error(new i(t,e,r))}};t([r()],n.prototype,"effectiveMax",null),t([r()],n.prototype,"effectiveMin",null),t([r()],n.prototype,"labelFormatFunction",null),t([r()],n.prototype,"inputFormatFunction",null),t([r()],n.prototype,"inputParseFunction",null),t([r({readOnly:!0})],n.prototype,"labels",null),t([r()],n.prototype,"max",null),t([r()],n.prototype,"min",null),t([r()],n.prototype,"precision",void 0),t([r({readOnly:!0})],n.prototype,"state",null),t([r()],n.prototype,"thumbsConstrained",void 0),t([r()],n.prototype,"values",null),n=t([o("esri.widgets.Slider.SliderViewModel")],n);const l=n;export{l as default};
|