@arcgis/core 4.24.0-next.20220508 → 4.24.0-next.20220511
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/AggregateGraphic.js +1 -1
- package/analysis/Analysis.js +1 -1
- package/analysis/DimensioningAnalysis.js +1 -1
- package/analysis/LengthDimension.d.ts +4 -0
- package/analysis/LengthDimension.js +5 -0
- package/analysis/dimensionUtils.js +5 -0
- package/arcade/Dictionary.js +1 -1
- package/arcade/Feature.js +1 -1
- package/arcade/arcade.js +1 -1
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/credentials.js +1 -1
- package/arcade/featureSetCollection.js +1 -1
- package/arcade/featureSetUtils.js +1 -1
- package/arcade/featureset/actions/Adapted.js +1 -1
- package/arcade/featureset/actions/AttributeFilter.js +1 -1
- package/arcade/featureset/actions/GroupBy.js +1 -1
- package/arcade/featureset/actions/OrderBy.js +1 -1
- package/arcade/featureset/actions/SpatialFilter.js +1 -1
- package/arcade/featureset/actions/Top.js +1 -1
- package/arcade/featureset/sources/Empty.js +1 -1
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
- package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
- package/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/featureset/support/FeatureSetIterator.js +1 -1
- package/arcade/featureset/support/shared.js +1 -1
- package/arcade/featureset/support/stats.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetgeom.js +1 -1
- package/arcade/functions/featuresetstats.js +1 -1
- package/arcade/functions/featuresetstring.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/languageUtils.js +1 -1
- package/arcade/request.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0564f1cfa3d17ff1aad3.js +1 -0
- package/assets/esri/core/workers/chunks/0806d5d706a864542bfb.js +1 -0
- package/assets/esri/core/workers/chunks/0a6977144ea1abf96fbf.js +1 -0
- package/assets/esri/core/workers/chunks/13387f56acbc3291561a.js +1 -0
- package/assets/esri/core/workers/chunks/16c4e0a32d50d4db984d.js +1 -0
- package/assets/esri/core/workers/chunks/{076d1b1101b59af0d389.js → 1c010202b4c7e1d15f23.js} +1 -1
- package/assets/esri/core/workers/chunks/26827ec144676e6385f8.js +1 -0
- package/assets/esri/core/workers/chunks/287c484fd40eee643f3a.js +1 -0
- package/assets/esri/core/workers/chunks/5210f0b42dba27945226.js +1 -0
- package/assets/esri/core/workers/chunks/{db6c5b3b4efe8d804f9c.js → 52478ee2d2a1354b6900.js} +1 -1
- package/assets/esri/core/workers/chunks/5759af97f96f24c40105.js +1 -0
- package/assets/esri/core/workers/chunks/{b85218d44c6094b7e5e6.js → 6d7e2a23a0a5dd9ded1d.js} +1 -1
- package/assets/esri/core/workers/chunks/70b6356357e7640c4e8b.js +1 -0
- package/assets/esri/core/workers/chunks/7574316b3af61c389e8f.js +1 -0
- package/assets/esri/core/workers/chunks/7bc828fbdd54c0b28aac.js +1 -0
- package/assets/esri/core/workers/chunks/7e5c22b5a32ac74b1b6e.js +1 -0
- package/assets/esri/core/workers/chunks/8102bb78fe96e6197e4e.js +1 -0
- package/assets/esri/core/workers/chunks/88384e7cafbfd2348598.js +1 -0
- package/assets/esri/core/workers/chunks/9d7533aaeac3b8d145c4.js +1 -0
- package/assets/esri/core/workers/chunks/{1eecae5227318f491263.js → 9f4d892abf55e8625bc9.js} +3 -3
- package/assets/esri/core/workers/chunks/{98607a0da63626cc4614.js → a054a52712a118c6d505.js} +1 -1
- package/assets/esri/core/workers/chunks/{69a20e4d9e28c3e599fc.js → a3bb600bfcb0282622f1.js} +1 -1
- package/assets/esri/core/workers/chunks/aa49841b14c6e6df2a07.js +1 -0
- package/assets/esri/core/workers/chunks/b089058b64db3912478f.js +1 -0
- package/assets/esri/core/workers/chunks/b28539c5a6bedb71b038.js +1 -0
- package/assets/esri/core/workers/chunks/b4f171db73355c6f766e.js +1 -0
- package/assets/esri/core/workers/chunks/b7572b0921b23aef8b9d.js +1 -0
- package/assets/esri/core/workers/chunks/b758f3c419edc2306784.js +1 -0
- package/assets/esri/core/workers/chunks/c3e7290fb128d4fefd44.js +1 -0
- package/assets/esri/core/workers/chunks/c51c9b5da855f84b9a48.js +1 -0
- package/assets/esri/core/workers/chunks/c66ac36da6392b6bf331.js +1 -0
- package/assets/esri/core/workers/chunks/d16b328d32a6ddc2fdb9.js +1 -0
- package/assets/esri/core/workers/chunks/d94c5f36d52cf71f0bb9.js +1 -0
- package/assets/esri/core/workers/chunks/db937849b2c1af87b481.js +1 -0
- package/assets/esri/core/workers/chunks/{66cd99e91dad60c5274c.js → dc3ed59f450283d97a19.js} +1 -1
- package/assets/esri/core/workers/chunks/dcd0653191cd4a1ccaae.js +2 -0
- package/assets/esri/core/workers/chunks/{31df729c17470245288c.js.LICENSE.txt → dcd0653191cd4a1ccaae.js.LICENSE.txt} +2 -2
- package/assets/esri/core/workers/chunks/e4fdd1eaf987977d0a51.js +1 -0
- package/assets/esri/core/workers/chunks/e51f0e71f2a55af604d3.js +1 -0
- package/assets/esri/core/workers/chunks/eb3855d3753d6b8334bd.js +1 -0
- package/assets/esri/core/workers/chunks/{7c290763920f52a1f504.js → eeed138930a4a805691d.js} +1 -1
- package/assets/esri/core/workers/chunks/f435dc615fdc8917f6ca.js +1 -0
- package/assets/esri/core/workers/chunks/{d5c5b9f7f5401f36a3a5.js → f7f3dde4c8f9c687cc1e.js} +1 -1
- package/assets/esri/core/workers/chunks/fc6beaf9466ea3898549.js +1 -0
- package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
- package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -0
- package/assets/esri/themes/base/widgets/_Weather.scss +1 -2
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/BlendLayers.glsl.js +6 -6
- package/chunks/arcade.js +1 -1
- package/chunks/array.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/config.js +1 -1
- package/core/sql/StandardizedFunctions.js +1 -1
- package/geohash/GeohashTree.js +1 -1
- package/geometry/support/contains.js +1 -1
- package/geometry/support/heightModelInfoUtils.js +1 -1
- package/geometry/support/intersects.js +1 -1
- package/geometry/support/intersectsBase.js +1 -1
- package/geometry/support/normalizeUtilsCommon.js +1 -1
- package/geometry/support/spatialReferenceUtils.js +1 -1
- package/interfaces.d.ts +685 -37
- package/layers/MediaLayer.d.ts +4 -0
- package/layers/MediaLayer.js +5 -0
- package/layers/VoxelLayer.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +5 -0
- package/layers/graphics/OptimizedGeometry.js +1 -1
- package/layers/graphics/data/BoundsStore.js +1 -1
- package/layers/support/CornersGeoreference.d.ts +4 -0
- package/layers/support/CornersGeoreference.js +5 -0
- package/layers/support/ExtentAndRotationGeoreference.d.ts +4 -0
- package/layers/support/ExtentAndRotationGeoreference.js +5 -0
- package/layers/support/FeatureReduction.js +1 -1
- package/layers/support/FeatureReductionBinning.js +5 -0
- package/layers/support/GeoreferenceBase.js +5 -0
- package/layers/support/ImageElement.d.ts +4 -0
- package/layers/support/ImageElement.js +5 -0
- package/layers/support/LocalMediaElementSource.d.ts +4 -0
- package/layers/support/LocalMediaElementSource.js +5 -0
- package/layers/support/MediaElementBase.d.ts +4 -0
- package/layers/support/MediaElementBase.js +5 -0
- package/layers/support/RouteStopSymbols.d.ts +4 -0
- package/layers/support/RouteSymbols.d.ts +4 -0
- package/layers/support/VoxelFormat.d.ts +4 -0
- package/layers/support/VoxelStyle.d.ts +4 -0
- package/layers/support/VoxelVariable.d.ts +4 -0
- package/layers/support/VoxelVolume.d.ts +4 -0
- package/layers/support/VoxelVolumeStyle.d.ts +4 -0
- package/layers/support/arcgisLayerUrl.js +1 -1
- package/layers/support/featureReductionUtils.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/rasterFormats/Lerc.js +1 -1
- package/package.json +3 -3
- package/request.js +1 -1
- package/support/requestUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/Font.js +1 -1
- package/symbols/support/textUtils.js +1 -1
- package/views/2d/engine/brushes.js +1 -1
- package/views/2d/engine/webgl/FeatureTile.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +5 -0
- package/views/2d/engine/webgl/OverlayContainer.js +5 -0
- package/views/2d/engine/webgl/brushes/BrushOverlay.js +5 -0
- package/views/2d/engine/webgl/collisions/CollisionEngine.js +1 -1
- package/views/2d/engine/webgl/shaders/OverlayPrograms.js +5 -0
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layerViewModuleImportUtils.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/MapImageLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +5 -0
- package/views/2d/layers/StreamLayerView2D.js +1 -1
- package/views/2d/layers/WMTSLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureStore2D.js +1 -1
- package/views/2d/layers/features/Pipeline.js +1 -1
- package/views/2d/layers/features/Store2D.js +1 -1
- package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
- package/views/2d/layers/features/processors/SymbolProcessor.js +1 -1
- package/views/2d/layers/features/schemaUtils.js +1 -1
- package/views/2d/layers/features/sources/GeoEventSource.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/BinStore.js +5 -0
- package/views/2d/layers/features/support/ClusterStore.js +1 -1
- package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/2d/layers/support/clusterUtils.js +1 -1
- package/views/2d/magnifier/MagnifierView2D.js +1 -1
- package/views/2d/navigation/actions/Pinch.js +1 -1
- package/views/2d/viewpointUtils.js +1 -1
- package/views/3d/analysis/AnalysisView3D.js +1 -1
- package/views/3d/analysis/Dimensioning/DimensioningTool.js +5 -0
- package/views/3d/analysis/Dimensioning/DimensioningVisualization.js +1 -1
- package/views/3d/analysis/Dimensioning/LengthDimensionSubTool.js +5 -0
- package/views/3d/analysis/Dimensioning/{LinearDimensionVisualization.js → LengthDimensionVisualization.js} +1 -1
- package/views/3d/analysis/Dimensioning/settings.js +5 -0
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/interactive/SegmentLabels3D.js +5 -0
- package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/GraphicReshapeTool.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.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/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
- package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
- package/views/3d/layerViewModuleImportUtils.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +5 -0
- package/views/3d/layers/VoxelLayerView3D.js +1 -1
- package/views/3d/layers/i3s/IDBCache.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
- package/views/3d/state/controllers/local/ZoomController.js +1 -1
- package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
- package/views/3d/support/ResourceController.js +1 -1
- package/views/3d/support/sunUtils.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TileCompositor.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/core/shaderLibrary/util/BlendLayers.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/materials/WaterGLMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/GroundView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/ToolViewManager.js +1 -1
- package/views/View.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/interactive/GraphicManipulator.js +1 -1
- package/views/interactive/InteractiveToolBase.js +1 -1
- package/views/interactive/SegmentLabels.js +5 -0
- package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
- package/views/interactive/snapping/LineSnapper.js +1 -1
- package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
- package/views/interactive/snapping/RightAngleSnapper.js +1 -1
- package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
- package/views/interactive/snapping/SnappingAlgorithm.js +1 -1
- package/views/interactive/snapping/SnappingManager.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/snappingUtils.js +1 -1
- package/views/interactive/support/viewUtils.js +5 -0
- package/views/interactive/tooltip/DrawPointTooltipInfo.js +5 -0
- package/views/interactive/tooltip/DrawPolygonTooltipInfo.js +5 -0
- package/views/interactive/tooltip/DrawPolylineTooltipInfo.js +5 -0
- package/views/interactive/tooltip/Tooltip.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
- package/views/interactive/tooltip/support/measurements.js +5 -0
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/layers/GroupLayerView.js +1 -1
- package/views/overlay/TextOverlayItem.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/views/support/screenUtils.js +1 -1
- package/webscene/Slide.js +1 -1
- package/widgets/Attribution/AttributionViewModel.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/ElevationProfile.js +1 -1
- package/widgets/Feature/FeatureAttachments.js +1 -1
- package/widgets/Feature/FeatureContent/FeatureContentViewModel.js +1 -1
- package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
- package/widgets/Feature/FeatureExpression.js +1 -1
- package/widgets/Feature/FeatureFields.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Feature.js +1 -1
- package/widgets/FeatureForm/InputFieldGroup.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/FeatureTable/Grid/Column.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +11 -11
- package/widgets/FeatureTable/Grid/support/ButtonMenu.js +1 -1
- package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
- package/widgets/FeatureTemplates/TemplateItem.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
- package/widgets/FloorFilter.js +1 -1
- package/widgets/HistogramRangeSlider.js +1 -1
- package/widgets/LayerList/LayerListViewModel.js +1 -1
- package/widgets/LayerList/ListItem.js +1 -1
- package/widgets/LayerList/ListItemPanel.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Legend/styles/Card.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Legend.js +1 -1
- package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
- package/widgets/Measurement.js +1 -1
- package/widgets/NavigationToggle/NavigationToggleViewModel.js +1 -1
- package/widgets/Popup/PopupViewModel.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/Print/FileLink.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ScaleBar.js +1 -1
- package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/TableList/ListItem.js +1 -1
- package/widgets/Weather/LabeledSlider.js +1 -1
- package/widgets/Weather/VisibleElements.js +5 -0
- package/widgets/Weather/css.js +1 -1
- package/widgets/Weather.js +1 -1
- package/widgets/support/AnalysisViewModel.js +1 -1
- package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
- package/analysis/LinearDimension.d.ts +0 -4
- package/analysis/LinearDimension.js +0 -5
- package/assets/esri/core/workers/chunks/0018053ac16a09feba70.js +0 -1
- package/assets/esri/core/workers/chunks/042938ca73f0b9e5a7e2.js +0 -1
- package/assets/esri/core/workers/chunks/048645611caa28dca7cd.js +0 -1
- package/assets/esri/core/workers/chunks/0b72d123386dc4ec7538.js +0 -1
- package/assets/esri/core/workers/chunks/13b04d5bf348ab5054c2.js +0 -1
- package/assets/esri/core/workers/chunks/215007e7c44811d90777.js +0 -1
- package/assets/esri/core/workers/chunks/31df729c17470245288c.js +0 -2
- package/assets/esri/core/workers/chunks/36272141b3c33cb19026.js +0 -1
- package/assets/esri/core/workers/chunks/36c8e8de9c3f67d32572.js +0 -1
- package/assets/esri/core/workers/chunks/37c428489c59df4b597b.js +0 -1
- package/assets/esri/core/workers/chunks/493169fd978fd543ef3b.js +0 -1
- package/assets/esri/core/workers/chunks/4f378ad6f4299183df85.js +0 -1
- package/assets/esri/core/workers/chunks/58e4c6ce1580427e7b55.js +0 -1
- package/assets/esri/core/workers/chunks/6c5441da675a8af35be2.js +0 -1
- package/assets/esri/core/workers/chunks/6ea16f6a0df946de480b.js +0 -1
- package/assets/esri/core/workers/chunks/7dfd70f4fa1096e56641.js +0 -1
- package/assets/esri/core/workers/chunks/88193e61072d7bf957f5.js +0 -1
- package/assets/esri/core/workers/chunks/8ccbde593c86c872e525.js +0 -1
- package/assets/esri/core/workers/chunks/9c6be39f1f21ab8b1c2d.js +0 -1
- package/assets/esri/core/workers/chunks/a73795cce722ba15b3da.js +0 -1
- package/assets/esri/core/workers/chunks/a8ed1a938dc164b401d9.js +0 -1
- package/assets/esri/core/workers/chunks/a9a73bc4875a5aeaf1b9.js +0 -1
- package/assets/esri/core/workers/chunks/adcc5bce6c0971c1b592.js +0 -1
- package/assets/esri/core/workers/chunks/afddfe620e6539991e6b.js +0 -1
- package/assets/esri/core/workers/chunks/b340c9bdabdb37995c8f.js +0 -1
- package/assets/esri/core/workers/chunks/b4c23630d6c85f7b59c0.js +0 -1
- package/assets/esri/core/workers/chunks/c180c40838246985479d.js +0 -1
- package/assets/esri/core/workers/chunks/caed2365bd296fcc8a75.js +0 -1
- package/assets/esri/core/workers/chunks/d85b5b73a151c6fbb658.js +0 -1
- package/assets/esri/core/workers/chunks/da6261673c3e1537b6a6.js +0 -1
- package/assets/esri/core/workers/chunks/dafe120243db6648a4ab.js +0 -1
- package/assets/esri/core/workers/chunks/ec6d138e8183e193f977.js +0 -1
- package/assets/esri/core/workers/chunks/ed4519ac9533a4d340f1.js +0 -1
- package/assets/esri/core/workers/chunks/f206300eef4560611728.js +0 -1
- package/assets/esri/core/workers/chunks/f55cbaf5a1d6ee6ac171.js +0 -1
- package/layers/GeoreferencedImageLayer.d.ts +0 -4
- package/layers/GeoreferencedImageLayer.js +0 -5
- package/layers/VoxelWasmManager.js +0 -5
- package/layers/VoxelWasmPerScene.js +0 -5
- package/views/3d/interactive/measurementTools/support/viewUtils.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../../../core/Error.js";import e from"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import{clamp as s}from"../../../../../core/mathUtils.js";import{isNone as r,isSome as a,mapMany as o,forEachSome as n,applySome as l,unwrap as h}from"../../../../../core/maybe.js";import{createResolver as c,isAbortError as u}from"../../../../../core/promiseUtils.js";import{diff as d}from"../../../../../core/accessorSupport/diffUtils.js";import p from"../../../../../layers/support/FieldsIndex.js";import{MAX_FILTERS as g,HIGHLIGHT_FLAG as _,ATTRIBUTE_DATA_VV as f,NAN_MAGIC_NUMBER as m,ATTRIBUTE_DATA_ANIMATION as y,ATTRIBUTE_DATA_GPGPU as b}from"../../../engine/webgl/definitions.js";import{DISPLAY_ID_TYPE_AGGREGATE as x,DISPLAY_ID_TYPE_FEATURE as T,getDisplayIdTexel as z,getDisplayIdType as S,getDisplayIdFilterMask as E}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as w}from"../../../engine/webgl/Utils.js";import{createDebugLogger as A,DEBUG_ATTR_UPDATES as D}from"../../../engine/webgl/util/debug.js";import{getVisualVariableSizeValueRepresentationRatio as k}from"../tileRenderers/support/visualVariablesUtils.js";import{PixelType as U}from"../../../../webgl/enums.js";const F=i.getLogger("esri.views.layers.2d.features.support.AttributeStore"),M=A(D,F),B={sharedArrayBuffer:e("esri-shared-array-buffer"),atomics:e("esri-atomics")};function v(t,e){return i=>e(t(i))}class C{constructor(t,e,i,s){this.size=0,this.texelSize=4;const{pixelType:r,layout:a,textureOnly:o}=s;this.textureOnly=o||!1,this.pixelType=r,this._ctype=e,this.layout=a,this._resetRange(),this._shared=t,this.size=i,o||(this.data=this._initData(r,i,t,e))}get buffer(){return l(this.data,(t=>t.buffer))}unsetComponentAllTexels(t,e){const i=h(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=h(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=h(this.data);for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){h(this.data)[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){h(this.data)[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=z(t);return h(this.data)[i*this.texelSize+e]}setData(t,e,i){const s=z(t),r=1<<e;0!=(this.layout&r)?(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):F.error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}lock(){this.pixelType===U.UNSIGNED_BYTE&&this._shared&&B.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,1)}unlock(){this.pixelType===U.UNSIGNED_BYTE&&this._shared&&B.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,0)}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t,this._shared,this._ctype),i=h(this.data);e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!(this._shared||"local"===this._ctype),r=this.pixelType,a=this.layout,o=h(this.data);return{start:t,end:e,data:s&&o.slice(t*i,(e+1)*i)||null,pixelType:r,layout:a}}_initData(t,e,i,s){const r=i&&"local"!==s?SharedArrayBuffer:ArrayBuffer,a=w(t),o=new a(new r(e*e*4*a.BYTES_PER_ELEMENT));for(let n=0;n<o.length;n+=4)o[n+1]=255;return o}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class R{constructor(t,e){this._client=t,this.config=e,this._attributeComputeMap=new Map,this._blocks=new Array,this._filters=new Array(g),this._targetType=0,this._abortController=new AbortController,this._hasScaleExpr=!1,this._size=32,this._idsToHighlight=new Set;const i=e.supportsTextureFloat?U.FLOAT:U.UNSIGNED_BYTE;M(`Creating AttributeStore ${B.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:U.UNSIGNED_BYTE,layout:1},{pixelType:U.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:U.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:i,layout:15},{pixelType:i,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}destroy(){this._abortController.abort()}get hasScaleExpr(){return this._hasScaleExpr}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}update(t,i){this.config=i;const s=i.schema.processors[0].storage,o=d(this._schema,s);if((t.targets.feature||t.targets.aggregate)&&(t.storage.data=!0),o&&(e("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:",o),t.storage.data=!0,this._schema=s,this._attributeComputeMap.clear(),!r(s))){switch(s.target){case"feature":this._targetType=T;break;case"aggregate":this._targetType=x}if("subtype"===s.type)for(const t in s.mapping){const e=s.mapping[t];if(a(e)&&a(e.vvMapping))for(const t of e.vvMapping)this._bindAttribute(t)}else{if(a(s.vvMapping))for(const t of s.vvMapping)this._bindAttribute(t);if(a(s.attributeMapping))for(const t of s.attributeMapping)this._bindAttribute(t)}}}onTileData(t,e){if(r(e.addOrUpdate))return;const i=e.addOrUpdate.getCursor();for(;i.next();){const t=i.getDisplayId();this.setAttributeData(t,i)}}invalidateResources(){this._createResourcesPromise=null,this._abortController.abort(),this._abortController=new AbortController}async setHighlight(t,e){const i=1,s=this._getBlock(0),r=e.map((t=>z(t)));s.lock(),s.unsetComponentAllTexels(0,i),s.setComponent(0,i,r),s.unlock(),this._idsToHighlight.clear();for(const a of t)this._idsToHighlight.add(a);await this.sendUpdates()}async updateFilters(t,i){const{config:s,service:r,spatialReference:a}=i,{filters:o}=s,n=o.map(((t,e)=>this._updateFilter(t,e,r,a)));(await Promise.all(n)).some((t=>t))&&(t.storage.filters=!0,e("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:","Filters changed"))}setData(t,e,i,s){const r=z(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlag(t){return this._idsToHighlight.has(t)?_:0}unsetAttributeData(t){const e=z(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e){const i=z(t);if(this._ensureSizeForTexel(i),this._getBlock(0).setData(i,0,this.getFilterFlags(e)),this._targetType!==S(t))return;const r=this._attributeComputeMap,a=this.config.supportsTextureFloat?1:2,o=4;r.size&&r.forEach(((t,r)=>{const n=r*a%o,l=Math.floor(r*a/o),h=this._getBlock(l+f),c=t(e);if(this.config.supportsTextureFloat)h.setData(i,n,c);else if(c===m)h.setData(i,n,255),h.setData(i,n+1,255);else{const t=s(Math.round(c),-32767,32766)+32768,e=255&t,r=(65280&t)>>8;h.setData(i,n,e),h.setData(i,n+1,r)}}))}sendUpdates(){if(this._nextUpdate)return this._nextUpdate.promise;if(this._currUpdate)return this._nextUpdate=c(),this._nextUpdate.promise;const e={blocks:this._blocks.map((t=>a(t)?t.toMessage():null))};return this._currUpdate=this._createResources().then((()=>{const t=()=>{if(this._currUpdate=null,this._nextUpdate){const t=this._nextUpdate;this._nextUpdate=null,this.sendUpdates().then((()=>t.resolve()))}},i=this._client.update(e,this._signal).then(t).catch(t);return this._client.render(this._signal),i})).catch((e=>{if(u(e))return this._createResourcesPromise=null,this._createResources();F.error(new t("mapview-attribute-store","Encountered an error during client update",e))})),this._currUpdate}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}_bindAttribute(t){function e(){return t.normalizationField?e=>{const i=e.readAttribute(t.normalizationField);if(!i)return null;return e.readAttribute(t.field)/i}:e=>e.readAttribute(t.field)}function i(){return t.normalizationField&&F.warn("mapview-arcade","Ignoring normalizationField specified with an arcade expression which is not supported."),e=>e.getComputedNumericAtIndex(t.fieldIndex)}let s;if(null!=t.fieldIndex)s=i();else{if(!t.field)return;s=e()}if(t.valueRepresentation){s=v(s,(e=>k(e,t.valueRepresentation)))}const r=t=>null===t||isNaN(t)||t===1/0?m:t;this._attributeComputeMap.set(t.binding,v(s,r))}_createResources(){if(a(this._createResourcesPromise))return this._createResourcesPromise;this._getBlock(y),this._getBlock(b),M("Initializing AttributeStore");const e={shared:B.sharedArrayBuffer&&!("local"===this._client.type),size:this._size,blocks:o(this._blocks,(t=>({textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType})))},i=this._client.initialize(e,this._signal).catch((e=>{u(e)?this._createResourcesPromise=null:F.error(new t("mapview-attribute-store","Encountered an error during client initialization",e))}));return this._createResourcesPromise=i,i.then((()=>r(this._createResourcesPromise)?this._createResources():void 0)),i}_getBlock(t){const e=this._blocks[t];if(a(e))return e;M(`Initializing AttributeBlock at index ${t}`);const i=B.sharedArrayBuffer,s=this._client.type,r=new C(i,s,this._size,this._blockDescriptors[t]);return this._blocks[t]=r,this._createResourcesPromise=null,r}_expand(){if(this._size<this.config.maxTextureSize){const t=this._size<<=1;return M("Expanding block size to",t,this._blocks),n(this._blocks,(e=>e.expand(t))),this._createResourcesPromise=null,this._size=t,0}return F.error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}async _updateFilter(t,e,i,s){const o=this._filters[e],n=a(o)&&o.hash;if(!o&&!t)return!1;if(n===JSON.stringify(t))return!1;if(r(t)){if(!o)return!1;const t=1<<e+1,i=this._getBlock(0);return this._filters[e]=null,i.setComponentAllTexels(0,t),this.sendUpdates(),!0}const l=await this._getFilter(e,i);return await l.update(t,s),!0}async _getFilter(t,e){const i=this._filters[t];if(a(i))return i;const{default:s}=await import("./FeatureFilter.js"),r=new s({geometryType:e.geometryType,hasM:!1,hasZ:!1,timeInfo:e.timeInfo,fieldsIndex:new p(e.fields)});return this._filters[t]=r,r}isVisible(t){return!!(2&this._getBlock(0).getData(t,0))}getFilterFlags(t){let e=0;const i=E(t.getDisplayId());for(let a=0;a<this._filters.length;a++){const s=!!(i&1<<a),o=this._filters[a];e|=(!s||r(o)||o.check(t)?1:0)<<a}let s=0;if(this._idsToHighlight.size){const e=t.getObjectId();s=this.getHighlightFlag(e)}return e<<1|s}}export{R as default};
|
|
5
|
+
import t from"../../../../../core/Error.js";import e from"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import{clamp as s}from"../../../../../core/mathUtils.js";import{isNone as r,isSome as a,mapMany as o,forEachSome as n,applySome as l,unwrap as h}from"../../../../../core/maybe.js";import{createResolver as c,isAbortError as u}from"../../../../../core/promiseUtils.js";import{diff as d}from"../../../../../core/accessorSupport/diffUtils.js";import p from"../../../../../layers/support/FieldsIndex.js";import{MAX_FILTERS as _,HIGHLIGHT_FLAG as g,ATTRIBUTE_DATA_VV as f,NAN_MAGIC_NUMBER as m,ATTRIBUTE_DATA_ANIMATION as y,ATTRIBUTE_DATA_GPGPU as b}from"../../../engine/webgl/definitions.js";import{DISPLAY_ID_TYPE_AGGREGATE as x,DISPLAY_ID_TYPE_FEATURE as T,getDisplayIdTexel as z,getDisplayIdType as S,getDisplayIdFilterMask as E}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as w}from"../../../engine/webgl/Utils.js";import{createDebugLogger as A,DEBUG_ATTR_UPDATES as D}from"../../../engine/webgl/util/debug.js";import{getVisualVariableSizeValueRepresentationRatio as k}from"../tileRenderers/support/visualVariablesUtils.js";import{PixelType as U}from"../../../../webgl/enums.js";const F=i.getLogger("esri.views.layers.2d.features.support.AttributeStore"),M=A(D,F),B={sharedArrayBuffer:e("esri-shared-array-buffer"),atomics:e("esri-atomics")};function v(t,e){return i=>e(t(i))}class C{constructor(t,e,i,s){this.size=0,this.texelSize=4;const{pixelType:r,layout:a,textureOnly:o}=s;this.textureOnly=o||!1,this.pixelType=r,this._ctype=e,this.layout=a,this._resetRange(),this._shared=t,this.size=i,o||(this.data=this._initData(r,i,t,e))}get buffer(){return l(this.data,(t=>t.buffer))}unsetComponentAllTexels(t,e){const i=h(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=h(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=h(this.data);for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){h(this.data)[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){h(this.data)[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=z(t);return h(this.data)[i*this.texelSize+e]}setData(t,e,i){const s=z(t),r=1<<e;0!=(this.layout&r)?(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):F.error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}lock(){this.pixelType===U.UNSIGNED_BYTE&&this._shared&&B.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,1)}unlock(){this.pixelType===U.UNSIGNED_BYTE&&this._shared&&B.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,0)}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t,this._shared,this._ctype),i=h(this.data);e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!(this._shared||"local"===this._ctype),r=this.pixelType,a=this.layout,o=h(this.data);return{start:t,end:e,data:s&&o.slice(t*i,(e+1)*i)||null,pixelType:r,layout:a}}_initData(t,e,i,s){const r=i&&"local"!==s?SharedArrayBuffer:ArrayBuffer,a=w(t),o=new a(new r(e*e*4*a.BYTES_PER_ELEMENT));for(let n=0;n<o.length;n+=4)o[n+1]=255;return o}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class R{constructor(t,e){this._client=t,this.config=e,this._attributeComputeMap=new Map,this._blocks=new Array,this._filters=new Array(_),this._targetType=0,this._abortController=new AbortController,this._hasScaleExpr=!1,this._size=32,this._idsToHighlight=new Set;const i=e.supportsTextureFloat?U.FLOAT:U.UNSIGNED_BYTE;M(`Creating AttributeStore ${B.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:U.UNSIGNED_BYTE,layout:1},{pixelType:U.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:U.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:i,layout:15},{pixelType:i,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}destroy(){this._abortController.abort()}get hasScaleExpr(){return this._hasScaleExpr}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}update(t,i){this.config=i;const s=i.schema.processors[0].storage,o=d(this._schema,s);if((t.targets.feature||t.targets.aggregate)&&(t.storage.data=!0),o&&(e("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:",o),t.storage.data=!0,this._schema=s,this._attributeComputeMap.clear(),!r(s))){switch(s.target){case"feature":this._targetType=T;break;case"aggregate":this._targetType=x}if("subtype"===s.type)for(const t in s.mapping){const e=s.mapping[t];if(a(e)&&a(e.vvMapping))for(const t of e.vvMapping)this._bindAttribute(t)}else{if(a(s.vvMapping))for(const t of s.vvMapping)this._bindAttribute(t);if(a(s.attributeMapping))for(const t of s.attributeMapping)this._bindAttribute(t)}}}onTileData(t,e){if(r(e.addOrUpdate))return;const i=e.addOrUpdate.getCursor();for(;i.next();){const t=i.getDisplayId();this.setAttributeData(t,i)}}invalidateResources(){this._createResourcesPromise=null,this._abortController.abort(),this._abortController=new AbortController}async setHighlight(t,e){const i=1,s=this._getBlock(0),r=e.map((t=>z(t)));s.lock(),s.unsetComponentAllTexels(0,i),s.setComponent(0,i,r),s.unlock(),this._idsToHighlight.clear();for(const a of t)this._idsToHighlight.add(a);await this.sendUpdates()}async updateFilters(t,i,s){const{service:r,spatialReference:a}=s,{filters:o}=i,n=o.map(((t,e)=>this._updateFilter(t,e,r,a)));(await Promise.all(n)).some((t=>t))&&(t.storage.filters=!0,e("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:","Filters changed"))}setData(t,e,i,s){const r=z(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlag(t){return this._idsToHighlight.has(t)?g:0}unsetAttributeData(t){const e=z(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e){const i=z(t);if(this._ensureSizeForTexel(i),this._getBlock(0).setData(i,0,this.getFilterFlags(e)),this._targetType!==S(t))return;const r=this._attributeComputeMap,a=this.config.supportsTextureFloat?1:2,o=4;r.size&&r.forEach(((t,r)=>{const n=r*a%o,l=Math.floor(r*a/o),h=this._getBlock(l+f),c=t(e);if(this.config.supportsTextureFloat)h.setData(i,n,c);else if(c===m)h.setData(i,n,255),h.setData(i,n+1,255);else{const t=s(Math.round(c),-32767,32766)+32768,e=255&t,r=(65280&t)>>8;h.setData(i,n,e),h.setData(i,n+1,r)}}))}sendUpdates(){if(this._nextUpdate)return this._nextUpdate.promise;if(this._currUpdate)return this._nextUpdate=c(),this._nextUpdate.promise;const e={blocks:this._blocks.map((t=>a(t)?t.toMessage():null))};return this._currUpdate=this._createResources().then((()=>{const t=()=>{if(this._currUpdate=null,this._nextUpdate){const t=this._nextUpdate;this._nextUpdate=null,this.sendUpdates().then((()=>t.resolve()))}},i=this._client.update(e,this._signal).then(t).catch(t);return this._client.render(this._signal),i})).catch((e=>{if(u(e))return this._createResourcesPromise=null,this._createResources();F.error(new t("mapview-attribute-store","Encountered an error during client update",e))})),this._currUpdate}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}_bindAttribute(t){function e(){return t.normalizationField?e=>{const i=e.readAttribute(t.normalizationField);if(!i)return null;return e.readAttribute(t.field)/i}:e=>e.readAttribute(t.field)}function i(){return t.normalizationField&&F.warn("mapview-arcade","Ignoring normalizationField specified with an arcade expression which is not supported."),e=>e.getComputedNumericAtIndex(t.fieldIndex)}let s;if(null!=t.fieldIndex)s=i();else{if(!t.field)return;s=e()}if(t.valueRepresentation){s=v(s,(e=>k(e,t.valueRepresentation)))}const r=t=>null===t||isNaN(t)||t===1/0?m:t;this._attributeComputeMap.set(t.binding,v(s,r))}_createResources(){if(a(this._createResourcesPromise))return this._createResourcesPromise;this._getBlock(y),this._getBlock(b),M("Initializing AttributeStore");const e={shared:B.sharedArrayBuffer&&!("local"===this._client.type),size:this._size,blocks:o(this._blocks,(t=>({textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType})))},i=this._client.initialize(e,this._signal).catch((e=>{u(e)?this._createResourcesPromise=null:F.error(new t("mapview-attribute-store","Encountered an error during client initialization",e))}));return this._createResourcesPromise=i,i.then((()=>r(this._createResourcesPromise)?this._createResources():void 0)),i}_getBlock(t){const e=this._blocks[t];if(a(e))return e;M(`Initializing AttributeBlock at index ${t}`);const i=B.sharedArrayBuffer,s=this._client.type,r=new C(i,s,this._size,this._blockDescriptors[t]);return this._blocks[t]=r,this._createResourcesPromise=null,r}_expand(){if(this._size<this.config.maxTextureSize){const t=this._size<<=1;return M("Expanding block size to",t,this._blocks),n(this._blocks,(e=>e.expand(t))),this._createResourcesPromise=null,this._size=t,0}return F.error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}async _updateFilter(t,e,i,s){const o=this._filters[e],n=a(o)&&o.hash;if(!o&&!t)return!1;if(n===JSON.stringify(t))return!1;if(r(t)){if(!o)return!1;const t=1<<e+1,i=this._getBlock(0);return this._filters[e]=null,i.setComponentAllTexels(0,t),this.sendUpdates(),!0}const l=await this._getFilter(e,i);return await l.update(t,s),!0}async _getFilter(t,e){const i=this._filters[t];if(a(i))return i;const{default:s}=await import("./FeatureFilter.js"),r=new s({geometryType:e.geometryType,hasM:!1,hasZ:!1,timeInfo:e.timeInfo,fieldsIndex:new p(e.fields)});return this._filters[t]=r,r}isVisible(t){return!!(2&this._getBlock(0).getData(t,0))}getFilterFlags(t){let e=0;const i=E(t.getDisplayId());for(let a=0;a<this._filters.length;a++){const s=!!(i&1<<a),o=this._filters[a];e|=(!s||r(o)||o.check(t)?1:0)<<a}let s=0;if(this._idsToHighlight.size){const e=t.getObjectId();s=this.getHighlightFlag(e)}return e<<1|s}}export{R as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import"../../../../../geometry.js";import e from"../../../../../core/has.js";import t from"../../../../../core/Logger.js";import{isNone as s,applySome as r,mapOr as i}from"../../../../../core/maybe.js";import{diff as a,hasDiff as o}from"../../../../../core/accessorSupport/diffUtils.js";import{GeohashTree as h}from"../../../../../geohash/GeohashTree.js";import{setGeohashBuf as n,setGeohashXY as d}from"../../../../../geohash/geohashUtils.js";import{earth as g}from"../../../../../geometry/support/Ellipsoid.js";import{getInfo as l}from"../../../../../geometry/support/spatialReferenceUtils.js";import{convertToGeometry as p}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as c}from"../../../../../layers/graphics/OptimizedFeature.js";import{checkProjectionSupport as u,project as f}from"../../../../../layers/graphics/data/projectionSupport.js";import{createDisplayId as _}from"../../../engine/webgl/DisplayId.js";import{Store2D as m}from"../Store2D.js";import{FeatureSetReaderJSON as y}from"./FeatureSetReaderJSON.js";import I from"../../../../../geometry/SpatialReference.js";const b=t.getLogger("esri.view.2d.layers.features.support.BinStore"),v=12,x=5;function j(e){return 57.29577951308232*e}class L extends m{constructor(e,t,s,r){super(e,s),this._geohashLevel=x,this._geohashBuf=[],this._serviceInfo=r,this.geometryInfo=e.geometryInfo,this._spatialReference=t,this._projectionSupportCheck=u(t,I.WGS84),this._bitsets.geohash=s.getBitset(s.createBitset()),this._bitsets.inserted=s.getBitset(s.createBitset())}destroy(){this._tree&&this._tree.destroy()}async updateSchema(t,r){const i=this._schema;try{await super.updateSchema(t,r),await this._projectionSupportCheck}catch(d){}const n=a(i,r);r&&(!s(n)||t.source||t.storage.filters)?((o(n,"params.fields")||o(n,"params")||!this._tree||t.source)&&(this._tree&&this._tree.destroy(),this._tree=new h(this._statisticFields,this._serviceInfo),this._tree.onRelease=e=>e.displayId&&this._storage.releaseDisplayId(e.displayId),this._geohashLevel=this._schema.params.fixedBinLevel,this._rebuildTree(),e("esri-2d-update-debug")&&b.info("Aggregate mesh needs update due to tree changing")),e("esri-2d-update-debug")&&b.info("Aggregate mesh needs update due to tree changing"),t.targets[r.name]=!0,t.mesh=!1):i&&(t.mesh=!0)}clear(){this._rebuildTree()}sweepFeatures(e,t){this._bitsets.inserted.forEachSet((s=>{if(!e.has(s)){const e=t.lookupByDisplayIdUnsafe(s);this._remove(e)}}))}sweepAggregates(e,t,s){}onTileData(e,t,r,i,a=!0){if(!this._schema||s(t.addOrUpdate))return t;const o=this._getTransforms(e,this._spatialReference);{const e=t.addOrUpdate.getCursor();for(;e.next();)this._update(e,i)}if(t.status.mesh||!a)return t;const h=new Array;this._getBinsForTile(h,e,o,r),t.addOrUpdate=y.fromOptimizedFeatures(h,{...this._serviceInfo,geometryType:"esriGeometryPolygon"}),t.addOrUpdate.attachStorage(r),t.clear=!0,t.end=!0;{const s=t.addOrUpdate.getCursor();for(;s.next();){const t=s.getDisplayId();this._bitsets.computed.unset(t),this.setComputedAttributes(r,s,t,e.scale)}}return t}onTileUpdate(e){}getAggregate(e){const t=_(e,!0),s=this._tree.findIf((e=>e.displayId===t));return r(s,(e=>this._toAggregateGraphic(e)))}getAggregates(){return this._tree.findAllIf((e=>e.depth===this._geohashLevel)).map(this._toAggregateGraphic.bind(this))}getDisplayId(e){const t=this._tree.findIf((t=>t.id===e));return r(t,(e=>e.displayId))}getFeatureDisplayIdsForAggregate(e){const t=_(e,!0),s=this._tree.findIf((e=>e.displayId===t));return i(s,[],(e=>Array.from(e.displayIds)))}getDisplayIdForReferenceId(e){const t=this._tree.findIf((t=>1===t.displayIds.size&&t.displayIds.has(e)));return r(t,(e=>e.displayId))}_toAggregateGraphic(e){const t=this._spatialReference;return{referenceId:null,objectId:e.id,displayId:e.displayId,attributes:e.getAttributes(),geometry:p(e.getGeometry(t),"esriGeometryPolygon",!1,!1),centroid:null}}_rebuildTree(){this._bitsets.computed.clear(),this._bitsets.inserted.clear(),this._tree&&this._tree.clear()}_remove(e){const t=e.getDisplayId(),s=e.getXHydrated(),r=e.getYHydrated(),i=this._geohashBuf[2*t],a=this._geohashBuf[2*t+1];this._bitsets.inserted.has(t)&&(this._bitsets.inserted.unset(t),this._tree.removeCursor(e,s,r,i,a,this._geohashLevel))}_update(e,t){const s=e.getDisplayId(),r=this._bitsets.inserted,i=t.isVisible(s);if(i===r.has(s))return;if(!i)return void this._remove(e);const a=e.getXHydrated(),o=e.getYHydrated();if(!this._setGeohash(s,a,o))return;const h=this._geohashBuf[2*s],n=this._geohashBuf[2*s+1];this._tree.insertCursor(e,s,a,o,h,n,this._geohashLevel),r.set(s)}_setGeohash(e,t,s){if(this._bitsets.geohash.has(e))return!0;const r=this._geohashBuf;if(this._spatialReference.isWebMercator){const i=j(t/g.radius),a=i-360*Math.floor((i+180)/360),o=j(Math.PI/2-2*Math.atan(Math.exp(-s/g.radius)));n(r,e,o,a,v)}else{const i=f({x:t,y:s},this._spatialReference,I.WGS84);if(!i)return!1;n(r,e,i.y,i.x,v)}return this._bitsets.geohash.set(e),!0}_getBinsForTile(e,t,s,r){try{const{xLL:i,yLL:a,xTR:o,yTR:h,level:n}=this._getGeohashBounds(t),d=this._tree.getBins(i,a,o,h,n);for(const t of d){t.displayId||(t.displayId=r.createDisplayId(!0));const i=t.getGeometry(this._spatialReference,s.tile),a=new c(i,t.getAttributes());a.objectId=t.id,a.displayId=t.displayId,e.push(a)}}catch(i){return void b.error("Unable to get bins for tile",t.key.id)}}_getGeohashBounds(e){const t=this._getGeohashLevel(e.key.level),s=this._spatialReference.isWebMercator,r=this;function i(e,t,i){let a=0,o=0;if(s){const s=j(e/g.radius);a=s-360*Math.floor((s+180)/360),o=j(Math.PI/2-2*Math.atan(Math.exp(-t/g.radius)))}else{const s=f({x:e,y:t},r._spatialReference,I.WGS84);a=s.x,o=s.y}const h={geohashX:0,geohashY:0};return d(h,o,a,i),h}const a=i(e.extent.xmin,e.extent.ymin,t),o=i(e.extent.xmax,e.extent.ymax,t);return{xLL:a.geohashX,yLL:a.geohashY,xTR:o.geohashX,yTR:o.geohashY,level:t}}_getGeohashLevel(e){return this._schema.params.fixedBinLevel}_getTransforms(e,t){const s={originPosition:"upperLeft",scale:[e.resolution,e.resolution],translate:[e.bounds[0],e.bounds[3]]},r=l(t);if(!r)return{tile:s,left:null,right:null};const[i,a]=r.valid;return{tile:s,left:{...s,translate:[a,e.bounds[3]]},right:{...s,translate:[i-a+e.bounds[0],e.bounds[3]]}}}}export{L as BinStore};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../../geometry.js";import e from"../../../../../core/Evented.js";import t from"../../../../../core/has.js";import{isNone as s,isSome as r,applySome as i}from"../../../../../core/maybe.js";import{diff as a,hasDiff as o}from"../../../../../core/accessorSupport/diffUtils.js";import{GeohashTree as h}from"../../../../../geohash/GeohashTree.js";import{setGeohashBuf as l,setGeohashXY as n}from"../../../../../geohash/geohashUtils.js";import{earth as u}from"../../../../../geometry/support/Ellipsoid.js";import{getInfo as c}from"../../../../../geometry/support/spatialReferenceUtils.js";import{quantizeX as g,quantizeY as d}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeatureWithGeometry as f,OptimizedFeature as p}from"../../../../../layers/graphics/OptimizedFeature.js";import _ from"../../../../../layers/graphics/OptimizedGeometry.js";import{checkProjectionSupport as m,project as y}from"../../../../../layers/graphics/data/projectionSupport.js";import{TILE_SIZE as I}from"../../../engine/webgl/definitions.js";import{DISPLAY_ID_TEXEL_MASK as v}from"../../../engine/webgl/DisplayId.js";import{Store2D as b}from"../Store2D.js";import{FeatureSetReaderJSON as R}from"./FeatureSetReaderJSON.js";import C from"../../../../../geometry/SpatialReference.js";const M=12,x=1;class L extends f{constructor(e,t,s,r,i){super(new _([],[t,s]),r,null,e),this.geohashBoundsInfo=i}get count(){return this.attributes.cluster_count}static create(e,t,s,r,i,a,o,h){const l=new L(t,s,r,a,o);return l.displayId=e.createDisplayId(!0),l.referenceId=h,l.tileLevel=i,l}update(e,t,s,r,i,a){return this.geometry.coords[0]=e,this.geometry.coords[1]=t,this.tileLevel=s,this.attributes=r,this.geohashBoundsInfo=i,this.referenceId=null,this.referenceId=a,this}toJSON(){return{objectId:this.objectId,referenceId:1===this.attributes.cluster_count?this.referenceId:null,attributes:{...this.attributes,clusterId:this.objectId},geometry:{x:this.geometry.coords[0],y:this.geometry.coords[1]}}}}function j(e){return 57.29577951308232*e}class w extends b{constructor(t,s,r,i){super(t,r),this.events=new e,this._geohashLevel=0,this._tileLevel=0,this._aggregateValueRanges={},this._aggregateValueRangesChanged=!1,this._geohashBuf=[],this._clusters=new Map,this._tiles=new Map,this._serviceInfo=i,this.geometryInfo=t.geometryInfo,this._spatialReference=s,this._projectionSupportCheck=m(s,C.WGS84),this._bitsets.geohash=r.getBitset(r.createBitset()),this._bitsets.inserted=r.getBitset(r.createBitset())}async updateSchema(e,r){const i=this._schema;try{await super.updateSchema(e,r),await this._projectionSupportCheck}catch(n){}const l=a(i,r);r&&(!s(l)||e.source||e.storage.filters)?((o(l,"params.fields")||!this._tree||e.source)&&(this._tree=new h(this._statisticFields,this._serviceInfo),this._rebuildTree(),t("esri-2d-update-debug")&&console.debug("Aggregate mesh needs update due to tree changing")),t("esri-2d-update-debug")&&console.debug("Applying Update - ClusterStore:",l),e.targets[r.name]=!0,e.mesh=!1,this._aggregateValueRanges={}):i&&(e.mesh=!0)}clear(){this._rebuildTree()}sweepFeatures(e,t){this._bitsets.inserted.forEachSet((s=>{if(!e.has(s)){const e=t.lookupByDisplayIdUnsafe(s);this._remove(e)}}))}
|
|
5
|
+
import"../../../../../geometry.js";import e from"../../../../../core/Evented.js";import t from"../../../../../core/has.js";import{isNone as s,isSome as r,applySome as i}from"../../../../../core/maybe.js";import{diff as a,hasDiff as o}from"../../../../../core/accessorSupport/diffUtils.js";import{GeohashTree as h}from"../../../../../geohash/GeohashTree.js";import{setGeohashBuf as l,setGeohashXY as n}from"../../../../../geohash/geohashUtils.js";import{earth as u}from"../../../../../geometry/support/Ellipsoid.js";import{getInfo as c}from"../../../../../geometry/support/spatialReferenceUtils.js";import{quantizeX as g,quantizeY as d}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeatureWithGeometry as f,OptimizedFeature as p}from"../../../../../layers/graphics/OptimizedFeature.js";import _ from"../../../../../layers/graphics/OptimizedGeometry.js";import{checkProjectionSupport as m,project as y}from"../../../../../layers/graphics/data/projectionSupport.js";import{TILE_SIZE as I}from"../../../engine/webgl/definitions.js";import{DISPLAY_ID_TEXEL_MASK as v}from"../../../engine/webgl/DisplayId.js";import{Store2D as b}from"../Store2D.js";import{FeatureSetReaderJSON as R}from"./FeatureSetReaderJSON.js";import C from"../../../../../geometry/SpatialReference.js";const M=12,x=1;class L extends f{constructor(e,t,s,r,i){super(new _([],[t,s]),r,null,e),this.geohashBoundsInfo=i}get count(){return this.attributes.cluster_count}static create(e,t,s,r,i,a,o,h){const l=new L(t,s,r,a,o);return l.displayId=e.createDisplayId(!0),l.referenceId=h,l.tileLevel=i,l}update(e,t,s,r,i,a){return this.geometry.coords[0]=e,this.geometry.coords[1]=t,this.tileLevel=s,this.attributes=r,this.geohashBoundsInfo=i,this.referenceId=null,this.referenceId=a,this}toJSON(){return{objectId:this.objectId,referenceId:1===this.attributes.cluster_count?this.referenceId:null,attributes:{...this.attributes,clusterId:this.objectId},geometry:{x:this.geometry.coords[0],y:this.geometry.coords[1]}}}}function j(e){return 57.29577951308232*e}class w extends b{constructor(t,s,r,i){super(t,r),this.events=new e,this._geohashLevel=0,this._tileLevel=0,this._aggregateValueRanges={},this._aggregateValueRangesChanged=!1,this._geohashBuf=[],this._clusters=new Map,this._tiles=new Map,this._serviceInfo=i,this.geometryInfo=t.geometryInfo,this._spatialReference=s,this._projectionSupportCheck=m(s,C.WGS84),this._bitsets.geohash=r.getBitset(r.createBitset()),this._bitsets.inserted=r.getBitset(r.createBitset())}destroy(){this._tree.destroy()}async updateSchema(e,r){const i=this._schema;try{await super.updateSchema(e,r),await this._projectionSupportCheck}catch(n){}const l=a(i,r);r&&(!s(l)||e.source||e.storage.filters)?((o(l,"params.fields")||!this._tree||e.source)&&(this._tree&&this._tree.destroy(),this._tree=new h(this._statisticFields,this._serviceInfo),this._rebuildTree(),t("esri-2d-update-debug")&&console.debug("Aggregate mesh needs update due to tree changing")),t("esri-2d-update-debug")&&console.debug("Applying Update - ClusterStore:",l),e.targets[r.name]=!0,e.mesh=!1,this._aggregateValueRanges={}):i&&(e.mesh=!0)}clear(){this._rebuildTree()}sweepFeatures(e,t){this._bitsets.inserted.forEachSet((s=>{if(!e.has(s)){const e=t.lookupByDisplayIdUnsafe(s);this._remove(e)}}))}sweepAggregates(e,t,s){this._clusters.forEach(((r,i)=>{r&&r.tileLevel!==s&&(e.releaseDisplayId(r.displayId),t.unsetAttributeData(r.displayId),this._clusters.delete(i))}))}onTileData(e,t,r,i,a=!0){if(!this._schema||s(t.addOrUpdate))return t;const o=this._getTransforms(e,this._spatialReference);{const e=t.addOrUpdate.getCursor();for(;e.next();)this._update(e,i)}if(t.status.mesh||!a)return t;const h=new Array,l=this._schema.params.clusterRadius;this._getClustersForTile(h,e,l,r,o),t.addOrUpdate=R.fromOptimizedFeatures(h,this._serviceInfo),t.addOrUpdate.attachStorage(r),t.clear=!0,t.end=!0;{const s=t.addOrUpdate.getCursor();for(;s.next();){const t=s.getDisplayId();this._bitsets.computed.unset(t),this.setComputedAttributes(r,s,t,e.scale)}}return this._aggregateValueRangesChanged&&t.end&&(this.events.emit("valueRangesChanged",{valueRanges:this._aggregateValueRanges}),this._aggregateValueRangesChanged=!1),t}onTileUpdate({added:e,removed:t}){if(e.length){const t=e[0].level;this._tileLevel=t,this._setGeohashLevel(t)}if(!this._schema)return;const s=this._schema.params.clusterRadius;t.forEach((e=>{this._tiles.delete(e.key.id),this._markTileClustersForDeletion(e,s)}))}getAggregate(e){for(const t of this._clusters.values())if((t?.displayId&v)==(e&v))return t.toJSON();return null}getAggregates(){const e=[];for(const t of this._clusters.values())t?.tileLevel===this._tileLevel&&e.push(t.toJSON());return e}getDisplayId(e){const t=this._clusters.get(e);return t?t.displayId:null}getFeatureDisplayIdsForAggregate(e){const t=this._clusters.get(e);if(!t)return[];const s=t.geohashBoundsInfo;return this._tree.getRegionDisplayIds(s.xLL,s.yLL,s.xTR,s.yTR,s.level)}getDisplayIdForReferenceId(e){for(const t of this._clusters.values())if(t?.referenceId===e)return t.displayId;return null}getAggregateValueRanges(){return this._aggregateValueRanges}forEach(e){for(const[t,s]of this._clusters)s&&e(s,t)}size(){let e=0;return this.forEach((t=>e++)),e}_rebuildTree(){this._bitsets.computed.clear(),this._bitsets.inserted.clear(),this._tree&&this._tree.clear()}_remove(e){const t=e.getDisplayId(),s=e.getXHydrated(),r=e.getYHydrated(),i=this._geohashBuf[2*t],a=this._geohashBuf[2*t+1];this._bitsets.inserted.has(t)&&(this._bitsets.inserted.unset(t),this._tree.removeCursor(e,s,r,i,a,this._geohashLevel))}_update(e,t){const s=e.getDisplayId(),r=this._bitsets.inserted,i=t.isVisible(s);if(i===r.has(s))return;if(!i)return void this._remove(e);const a=e.getXHydrated(),o=e.getYHydrated();if(!this._setGeohash(s,a,o))return;const h=this._geohashBuf[2*s],l=this._geohashBuf[2*s+1];this._tree.insertCursor(e,s,a,o,h,l,this._geohashLevel),r.set(s)}_setGeohash(e,t,s){if(this._bitsets.geohash.has(e))return!0;const r=this._geohashBuf;if(this._spatialReference.isWebMercator){const i=j(t/u.radius),a=i-360*Math.floor((i+180)/360),o=j(Math.PI/2-2*Math.atan(Math.exp(-s/u.radius)));l(r,e,o,a,M)}else{const i=y({x:t,y:s},this._spatialReference,C.WGS84);if(!i)return!1;l(r,e,i.y,i.x,M)}return this._bitsets.geohash.set(e),!0}_getClustersForTile(e,t,a,o,h,l=!0){const n=this._schema.params.clusterPixelBuffer,u=2*a,c=this._getGeohashLevel(t.key.level),f=Math.ceil(2**t.key.level*I/u),_=Math.ceil(n/u)+0,m=Math.ceil(I/u),{row:y,col:v}=t.key,b=v*I,R=y*I,C=Math.floor(b/u)-_,M=Math.floor(R/u)-_,x=C+m+2*_,L=M+m+2*_,j=t.tileInfoView.getLODInfoAt(t.key.level);for(let I=C;I<=x;I++)for(let a=M;a<=L;a++){let n=I;j.wrap&&(n=I<0?I+f:I%f);const u=j.wrap&&I<0,_=j.wrap&&I%f!==I,m=this._lookupCluster(o,j,t.key.level,n,a,c);if(r(m)){const t=i(h,(e=>u?e.left:_?e.right:e.tile));if(l&&s(t))continue;if(!m.count)continue;if(r(t)&&l){const s=m.geometry.clone();let i=m.attributes;s.coords[0]=g(t,s.coords[0]),s.coords[1]=d(t,s.coords[1]),1===m.count&&r(m.referenceId)&&(i={...m.attributes,referenceId:m.referenceId});const a=new p(s,i);a.displayId=m.displayId,e.push(a)}}}}_getGeohashLevel(e){return Math.min(Math.ceil(e/2+2),M)}_setGeohashLevel(e){const t=this._getGeohashLevel(e),s=(Math.floor(t/x)+1)*x-1;if(this._geohashLevel!==s)return this._geohashLevel=s,this._rebuildTree(),void this._bitsets.geohash.clear()}_getTransforms(e,t){const s={originPosition:"upperLeft",scale:[e.resolution,e.resolution],translate:[e.bounds[0],e.bounds[3]]},r=c(t);if(!r)return{tile:s,left:null,right:null};const[i,a]=r.valid;return{tile:s,left:{...s,translate:[a,e.bounds[3]]},right:{...s,translate:[i-a+e.bounds[0],e.bounds[3]]}}}_getClusterId(e,t,s){return(15&e)<<28|(16383&t)<<14|16383&s}_markForDeletion(e,t,s){const r=this._getClusterId(e,t,s);this._clusters.delete(r)}_getClusterBounds(e,t,s){const r=this._schema.params.clusterRadius,i=2*r;let a=s%2?t*i:t*i-r;const o=s*i;let h=a+i;const l=o-i,n=2**e.level*I;e.wrap&&a<0&&(a=0),e.wrap&&h>n&&(h=n);const u=a/I,c=o/I,g=h/I,d=l/I;return[e.getXForColumn(u),e.getYForRow(c),e.getXForColumn(g),e.getYForRow(d)]}_lookupCluster(e,t,s,i,a,o){const h=this._getClusterId(s,i,a),l=this._clusters.get(h),[c,g,d,f]=this._getClusterBounds(t,i,a),p={x:c,y:g},_={x:d,y:f};let m=0,I=0,v=0,b=0;if(this._spatialReference.isWebMercator){{const e=j(p.x/u.radius);m=e-360*Math.floor((e+180)/360),I=j(Math.PI/2-2*Math.atan(Math.exp(-p.y/u.radius)))}{const e=j(_.x/u.radius);v=e-360*Math.floor((e+180)/360),b=j(Math.PI/2-2*Math.atan(Math.exp(-_.y/u.radius)))}}else{const e=y(p,this._spatialReference,C.WGS84),t=y(_,this._spatialReference,C.WGS84);if(!e||!t)return null;m=e.x,I=e.y,v=t.x,b=t.y}const R={geohashX:0,geohashY:0},M={geohashX:0,geohashY:0};n(R,I,m,o),n(M,b,v,o);const x=R.geohashX,w=R.geohashY,V=M.geohashX,S=M.geohashY,F={xLL:x,yLL:w,xTR:V,yTR:S,level:o},D=this._tree.getRegionStatistics(x,w,V,S,o),{count:T,xTotal:k,yTotal:B,referenceId:A}=D,G=T?k/T:0,O=T?B/T:0;if(0===T)return this._clusters.set(h,null),null;const U={cluster_count:T,...D.attributes},X=r(l)?l.update(G,O,s,U,F,A):L.create(e,h,G,O,s,U,F,A);return 0===T&&(X.geometry.coords[0]=(c+d)/2,X.geometry.coords[1]=(g+f)/2),this._clusters.set(h,X),this._updateAggregateValueRangeForCluster(X,X.tileLevel),X}_updateAggregateValueRangeForCluster(e,t){const s=this._aggregateValueRanges[t]||{minValue:1/0,maxValue:0},r=s.minValue,i=s.maxValue;s.minValue=Math.min(r,e.count),s.maxValue=Math.max(i,e.count),this._aggregateValueRanges[t]=s,r===s.minValue&&i===s.maxValue||(this._aggregateValueRangesChanged=!0)}_markTileClustersForDeletion(e,t){const s=2*t,r=Math.ceil(I/s),{row:i,col:a}=e.key,o=a*I,h=i*I,l=Math.floor(o/s),n=Math.floor(h/s);for(let u=l;u<l+r;u++)for(let t=n;t<n+r;t++)this._markForDeletion(e.key.level,u,t)}}export{L as ClusterInfo,w as ClusterStore};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../../core/has.js";import{createResolver as t}from"../../../../../../core/promiseUtils.js";import{brushes as s}from"../../../../engine/brushes.js";import{FeatureContainer as i}from"../../../../engine/FeatureContainer.js";import{WGLDrawPhase as r}from"../../../../engine/webgl/enums.js";const a=e("featurelayer-order-by-server-enabled");class n extends i{constructor(e,t,s,i){super(e),this._pointToCallbacks=[],this._layer=s,this._layerView=t,this._onUpdate=i}renderChildren(e){if(this.attributeView.update(),this.hasAnimation){e.painter.effects.integrate.draw(e,e.attributeView)}super.renderChildren(e)}hasEmptyAttributeView(){return this.attributeView.isEmpty()}isUpdating(){return this.attributeView.isUpdating()}hitTest(e){const s=t();return this._pointToCallbacks.push({point:e,resolver:s}),this.requestRender(),s.promise}onTileData(e,t){const s=a&&"orderBy"in this._layer&&this._layer.orderBy,i=s?.length&&!s[0].valueExpression&&s[0].field,r=s&&this._layerView.orderByFields===i;e.patch(t,r),this.contains(e)||this.addChild(e),this.requestRender()}onTileError(e){this.contains(e)||this.addChild(e)}updateTransitionProperties(e,t){super.updateTransitionProperties(e,t),this._layerView.featureEffectView.transitionStep(e,t),this._layerView.featureEffectView.transitioning&&this.requestRender()}doRender(e){const{minScale:t,maxScale:s}=this._layer,i=e.state.scale;i<=(t||1/0)&&i>=s&&super.doRender(e)}onAttributeStoreUpdate(){this.hasLabels&&this._layerView.view.labelManager.requestUpdate(),this._onUpdate()}get hasAnimation(){return this.hasLabels}setStencilReference(e){const{rendererSchema:t}=e.rendererInfo;if("dot-density"===t.type&&t.dotSize>1){const e=1;for(const t of this.children)t.stencilRef=t.key.level+e}else super.setStencilReference(e)}get hasLabels(){if("sublayers"in this._layer)return this._layer.sublayers.some((e=>e.labelingInfo&&e.labelingInfo.length&&e.labelsVisible));const e=this._layer.featureReduction,t=e&&"
|
|
5
|
+
import e from"../../../../../../core/has.js";import{createResolver as t}from"../../../../../../core/promiseUtils.js";import{brushes as s}from"../../../../engine/brushes.js";import{FeatureContainer as i}from"../../../../engine/FeatureContainer.js";import{WGLDrawPhase as r}from"../../../../engine/webgl/enums.js";const a=e("featurelayer-order-by-server-enabled");class n extends i{constructor(e,t,s,i){super(e),this._pointToCallbacks=[],this._layer=s,this._layerView=t,this._onUpdate=i}renderChildren(e){if(this.attributeView.update(),this.hasAnimation){e.painter.effects.integrate.draw(e,e.attributeView)}super.renderChildren(e)}hasEmptyAttributeView(){return this.attributeView.isEmpty()}isUpdating(){return this.attributeView.isUpdating()}hitTest(e){const s=t();return this._pointToCallbacks.push({point:e,resolver:s}),this.requestRender(),s.promise}onTileData(e,t){const s=a&&"orderBy"in this._layer&&this._layer.orderBy,i=s?.length&&!s[0].valueExpression&&s[0].field,r=s&&this._layerView.orderByFields===i;e.patch(t,r),this.contains(e)||this.addChild(e),this.requestRender()}onTileError(e){this.contains(e)||this.addChild(e)}updateTransitionProperties(e,t){super.updateTransitionProperties(e,t),this._layerView.featureEffectView.transitionStep(e,t),this._layerView.featureEffectView.transitioning&&this.requestRender()}doRender(e){const{minScale:t,maxScale:s}=this._layer,i=e.state.scale;i<=(t||1/0)&&i>=s&&super.doRender(e)}onAttributeStoreUpdate(){this.hasLabels&&this._layerView.view.labelManager.requestUpdate(),this._onUpdate()}get hasAnimation(){return this.hasLabels}setStencilReference(e){const{rendererSchema:t}=e.rendererInfo;if("dot-density"===t.type&&t.dotSize>1){const e=1;for(const t of this.children)t.stencilRef=t.key.level+e}else super.setStencilReference(e)}get hasLabels(){if("sublayers"in this._layer)return this._layer.sublayers.some((e=>e.labelingInfo&&e.labelingInfo.length&&e.labelsVisible));const e=this._layer.featureReduction,t=e&&"labelingInfo"in e&&e.labelsVisible&&e.labelingInfo&&e.labelingInfo.length;return this._layer.labelingInfo&&this._layer.labelingInfo.length&&this._layer.labelsVisible||!!t}prepareRenderPasses(e){const t=e.registerRenderPass({name:"label",brushes:[s.label],target:()=>this.hasLabels?this.children:null,drawPhase:r.LABEL|r.LABEL_ALPHA}),i=e.registerRenderPass({name:"geometry",brushes:[s.fill,s.dotDensity,s.line,s.marker,s.heatmap,s.text],target:()=>this.children,enableDefaultDraw:()=>!this._layerView.featureEffectView.hasEffects,effects:[{apply:e.effects.outsideEffect,enable:()=>this._layerView.featureEffectView.hasEffects,args:()=>this._layerView.featureEffectView.excludedEffects},{apply:e.effects.insideEffect,enable:()=>this._layerView.featureEffectView.hasEffects,args:()=>this._layerView.featureEffectView.includedEffects},{apply:e.effects.hittest,enable:()=>!!this._pointToCallbacks.length,args:()=>this._pointToCallbacks}]}),a=e.registerRenderPass({name:"highlight",brushes:[s.fill,s.dotDensity,s.line,s.marker,s.text],target:()=>this.children,drawPhase:r.HIGHLIGHT,enableDefaultDraw:()=>!1,effects:[{apply:e.effects.highlight,enable:()=>!!this._layerView.hasHighlight()}]});return[...super.prepareRenderPasses(e),i,a,t]}}export{n as WGLFeatureView};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{bidiText as s}from"../../../../core/BidiText.js";import{HandleOwnerMixin as i}from"../../../../core/HandleOwner.js";import r from"../../../../core/has.js";import{isSome as o,isNone as a}from"../../../../core/maybe.js";import{throwIfAborted as h,isAbortError as n,throwIfAbortError as l}from"../../../../core/promiseUtils.js";import{property as d}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import c from"../../../../geometry/SpatialReference.js";import{width as g,height as m,create as u}from"../../../../geometry/support/aaBoundingRect.js";import{closeRingsAndFixWinding as _}from"../../../../geometry/support/coordsUtils.js";import{getJsonType as f,isPolygon as y,isPolyline as b,isExtent as S,isPoint as w,isMultipoint as T}from"../../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridianSync as v}from"../../../../geometry/support/normalizeUtilsSync.js";import{getInfo as I}from"../../../../geometry/support/spatialReferenceUtils.js";import{checkProjectionSupport as U,project as G}from"../../../../layers/graphics/data/projectionSupport.js";import{symbolToCIM as M}from"../../../../symbols/cim/CIMSymbolHelper.js";import{errorPolylineSymbol2D as C,errorPolygonSymbol2D as j,errorPointSymbol2D as P}from"../../../../symbols/support/defaults.js";import{FILTER_FLAG_0 as x}from"../../engine/webgl/definitions.js";import{WGLSymbologyType as A}from"../../engine/webgl/enums.js";import{GraphicTile as R}from"../../engine/webgl/GraphicTile.js";import{TileData as q}from"../../engine/webgl/TileData.js";import D from"../../engine/webgl/WGLDisplayObject.js";import{MeshData as F}from"../../engine/webgl/mesh/MeshData.js";import{WGLMeshFactory as O}from"../../engine/webgl/mesh/factories/WGLMeshFactory.js";import{WGLTemplateStore as z}from"../../engine/webgl/mesh/templates/WGLTemplateStore.js";import{createMatcher as H}from"../../engine/webgl/util/Matcher.js";import{createMatcherSchema as k,createSymbolSchemaOptions as E}from"../features/schemaUtils.js";import N from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as V}from"../features/support/ComputedAttributeStorage.js";import{GraphicsReader as B}from"../features/support/GraphicsReader.js";import L from"./GraphicStore.js";import{intersectingInternationalDateline as W,isMarkerSymbol as J,isTextSymbol as Z,polygonFromExtent as K,TILE_SIZE as Q,PIXEL_BUFFER as X}from"./graphicsUtils.js";import{expandSymbol as Y}from"../support/cimSymbolUtils.js";import{GraphicsView as $}from"../../../layers/GraphicsView.js";import{getWebGLCapabilities as ee}from"../../../webgl/capabilities.js";import{createSymbolSchema as te}from"../features/createSymbolSchema.js";const se=r("esri-2d-graphic-debug");function ie(e,t,s){if(s.has(e))return s.get(e);const i={tile:t,addedOrModified:[],removed:[]};return s.set(e,i),i}let re=class extends($(i(t))){constructor(e){super(e),this._storage=new V,this._displayIds=new Map,this._controller=new AbortController,this._tiles=new Map,this._graphicStoreUpdate=!1,this._graphicsSet=new Set,this._matcher=Promise.resolve(null),this._tileUpdateSet=new Set,this._tilesToUpdate=new Map,this._graphicIdToAbortController=new Map,this._attached=!1,this._updatingGraphicsTimer=null,this._hashToExpandedSymbol=new Map,this._hashToExpandedSymbolPromise=new Map,this._hashToCIMSymbolPromise=new Map,this._hashToCIM=new Map,this._processing=!1,this._needsProcessing=!1,this._pendingUpdate={added:new Set,updated:new Set,removed:new Set},this.lastUpdateId=-1,this.updateRequested=!1,this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this._updatingGraphicsTimer&&(clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=null,this.notifyChange("updating")),this._controller.abort(),this.container.destroy(),this._set("graphics",null),this._graphicStore.clear(),this._attributeStore=null,this._hashToExpandedSymbol.clear(),this.view=null,this.renderer=null,this._hashToCIM.clear(),this._hashToCIMSymbolPromise.clear(),this._hashToExpandedSymbolPromise.clear()}_createMatcher(e,t,s){if(e){const i=k({indexCount:0,fields:{}},"feature",e);this._matcher=H(i,t,null,s)}}_createDisplayId(e){return this._displayIds.has(e)||this._displayIds.set(e,this._storage.createDisplayId()),this._displayIds.get(e)}initialize(){this._attributeStore=new N({type:"local",initialize:e=>Promise.resolve(this.container.attributeView.initialize(e)),update:e=>this.container.attributeView.requestUpdate(e),render:()=>this.container.requestRender()},ee("2d")),this.container.hasHighlight=()=>this._attributeStore.hasHighlight;const e=e=>{this._createDisplayId(e.uid),this._setFilterState(e.uid,e.visible)},t=e=>{const t=this._displayIds.get(e.uid);this._displayIds.delete(e.uid),this._storage.releaseDisplayId(t)},s=new z(this.container.getMaterialItems.bind(this.container),this.view.featuresTilingScheme.tileInfo);this._graphicStore=new L(this.view.featuresTilingScheme,this.view.state.scale,this.uid,this.graphics,e,t,this._hashToCIM),this._meshFactory=new O(null,this.uid,s),this._templateStore=s,this.handles.add([this.watch("renderer",(e=>{this._createMatcher(e,s,this.container.stage.resourceManager);for(const t of this.graphics)this._pendingUpdate.updated.add(t);this.requestUpdate()})),this.view.graphicsTileStore.on("update",(e=>this._onTileUpdate(e))),this.container.on("attach",(()=>{se&&this.container.enableRenderingBounds((()=>this._graphicStore.getAllBounds())),this.graphics.items.length>0&&this._graphicsChangeHandler({target:this.graphics,added:this.graphics.items,removed:[],moved:[]}),this.handles.add(this.graphics.on("change",(e=>this._graphicsChangeHandler(e))),"graphics");const e=this.container.stage.resourceManager;this._createMatcher(this.renderer,s,e),this._graphicStore.setResourceManager(e),this._attached=!0,this.notifyChange("updating")}))]);const i=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:i,removed:[]})}get updating(){return!this._attached||null!==this._updatingGraphicsTimer||this._tileUpdateSet.size>0||this._tilesToUpdate.size>0}hitTest(e){if(!this.view||!this.view.position)return null;const{resolution:t,rotation:s}=this.view.state;return this._graphicStore.hitTest(e.x,e.y,2,t,s)}update(e){h(this._controller.signal);const t=e.state,{resolution:s}=t;if(this._graphicStore.updateLevel(s),this._graphicStoreUpdate=!0,this.updateRequested=!1,this._pendingUpdate.updated.size>0){if(!this._processing)return void this._updateGraphics();this._needsProcessing=!0}}viewChange(){this.requestUpdate()}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback())}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}graphicUpdateHandler(e){const{graphic:t,property:s,newValue:i}=e;switch(s){case"attributes":case"geometry":case"symbol":this._pendingUpdate.updated.add(t),this.requestUpdate();break;case"visible":this._setFilterState(t.uid,i),this._attributeStore.sendUpdates()}}setHighlight(e){const t=e.map((e=>this._displayIds.get(e)));this._attributeStore.setHighlight(e,t)}_getIntersectingTiles(e){const t=this._graphicStore.getBounds(e);if(!t||0===g(t)||0===m(t))return[];const s=W(t,this.view.spatialReference);return o(s)?[...new Set([...this.view.graphicsTileStore.boundsIntersections(s[0]),...this.view.graphicsTileStore.boundsIntersections(s[1])])]:this.view.graphicsTileStore.boundsIntersections(t)}async _updateTile(e){h(this._controller.signal);const t=e.tile,s=this._getGraphicsData(this._templateStore,t,e.addedOrModified),i=await this._processGraphics(t,s);return h(this._controller.signal),this._patchTile(t.key,{type:"update",addOrUpdate:i,remove:e.removed,end:!0,clear:!1,sort:!1}),i}_patchTile(e,t){if(!this._tiles.has(e))return;const s=this._tiles.get(e);this.container.onTileData(s,t),this.container.requestRender()}_graphicsChangeHandler(e){const t=this._pendingUpdate;for(const s of e.added)t.added.add(s);for(const s of e.moved)t.updated.add(s);for(const s of e.removed)this._pendingUpdate.added.has(s)?t.added.delete(s):t.removed.add(s);this._processing?this._needsProcessing=!0:this._updateGraphics()}_getGraphicsToUpdate(){const e={added:[],removed:[],updated:[]};if(!this.graphics)return e;const t=this._pendingUpdate;for(const s of this.graphics.items)t.added.has(s)?e.added.push(s):t.updated.has(s)&&e.updated.push(s);for(const s of t.removed)this._graphicStore.has(s)&&e.removed.push(s);return t.added.clear(),t.removed.clear(),t.updated.clear(),e}async _updateGraphics(){this._processing=!0;const{added:e,removed:t,updated:s}=this._getGraphicsToUpdate(),i=this._tilesToUpdate;let r;try{if(!this._graphicStoreUpdate){const e=this.view.state,{resolution:t}=e;this._graphicStore.updateLevel(t)}const o=[],a=new Array(e.length+t.length);for(let e=0;e<s.length;e++){const t=s[e],h=this._getIntersectingTiles(t);for(const e of h){r=e.id;ie(r,e,i).removed.push(this._displayIds.get(t.uid))}o.push(this._updateGraphic(t,null)),a[e]=t}const h=s.length;for(let t=0;t<e.length;t++){const s=e[t];a[h+t]=s,this._graphicsSet.add(s),o.push(this._addGraphic(s))}for(const e of t){this._abortProcessingGraphic(e.uid);const t=this._getIntersectingTiles(e);for(const s of t){r=s.id;ie(r,s,i).removed.push(this._displayIds.get(e.uid))}this._graphicsSet.delete(e),this._graphicStore.remove(e)}let n;this._flipUpdatingGraphics(),await Promise.all(o);for(let e=0;e<a.length;e++){n=a[e];const t=this._getIntersectingTiles(n);for(const e of t){r=e.id;ie(r,e,i).addedOrModified.push(n)}}this._graphicStore.updateZ();const l=[];for(const[e,t]of i)l.push(this._updateTile(t));await Promise.all(l)}catch(o){n(o),0}for(const a of t)try{const e=await this._getSymbolForGraphic(a,{});if(e){const t=e.hash();this._hashToExpandedSymbol.delete(t)}}catch(o){n(o),0}i.clear(),this.notifyChange("updating"),this._processing=!1,this._needsProcessing&&(this._needsProcessing=!1,this._updateGraphics())}_getArcadeInfo(e){const t=(e.attributes?Object.keys(e.attributes):[]).map((t=>({name:t,alias:t,type:"string"==typeof e.attributes[t]?"esriFieldTypeString":"esriFieldTypeDouble"})));return a(e.geometry)?null:{geometryType:f(e.geometry),spatialReference:c.fromJSON(e.geometry.spatialReference),fields:t}}_getSymbolForGraphic(e,t){return h(this._controller.signal),o(e.symbol)?Promise.resolve(e.symbol):o(this.renderer)?this.renderer.getSymbolAsync(e,{scale:this.view.scale,abortOptions:t}):Promise.resolve(this._getNullSymbol(e))}_getCIMSymbol(e,t,s){let i=this._hashToCIM.get(t);if(i)return Promise.resolve(i);const r=M(e);if(o(r)){if("CIMSymbolReference"===r.type)return i=r,this._hashToCIM.set(t,i),Promise.resolve(i);let e=this._hashToCIMSymbolPromise.get(t);return e||(e=r.fetchCIMSymbol(s).then((e=>(this._hashToCIM.set(t,e.data),this._hashToCIMSymbolPromise.delete(t),e))).catch((e=>(this._hashToCIMSymbolPromise.delete(t),l(e),null))),this._hashToCIMSymbolPromise.set(t,e),e)}return Promise.resolve(null)}_expandCIMSymbol(e,t,s,i){const r=this._hashToExpandedSymbol.get(s);if(r)return Promise.resolve(r);let o=this._hashToExpandedSymbolPromise.get(s);if(o)return o;const a=this.container.stage,h=this._getArcadeInfo(t),n=E(null),l=te(e,n);return o=Y(l,h,a.resourceManager,i),this._hashToExpandedSymbolPromise.set(s,o),o.then((e=>(this._hashToExpandedSymbol.set(s,e),this._hashToExpandedSymbolPromise.delete(s),e))),o}async _getSymbolResources(e,t){h(this._controller.signal);return this.container.stage?this._getSymbolForGraphic(e,t).then((i=>{const r=i.hash();return this._getCIMSymbol(i,r,t).then((i=>a(i)?null:this._expandCIMSymbol(i,e,r,t).then((e=>{const t=e.layers.filter((e=>"text"===e.type&&"string"==typeof e.text));if(t&&t.length>0){const i=new Array(t.length);for(let e=0;e<t.length;e++){const r=t[e],o=[],[a]=s(r.text);r.text=a;for(let e=0;e<a.length;e++)o.push(a.charCodeAt(e));i[e]={symbol:r,id:e,glyphIds:o}}const o=new Map;return this.container.getMaterialItems(i).then((s=>{for(let e=0;e<t.length;e++){const i=t[e];o.set(i.cim,{text:i.text,mosaicItem:s[e].mosaicItem})}return{symbol:e,textInfo:o,hash:r}}))}return{symbol:e,hash:r}}))))})).catch((e=>(l(e),null))):null}async _projectAndNormalizeGeometry(e,t){if(h(this._controller.signal),a(e.geometry)||"mesh"===e.geometry.type)return null;let s=e.geometry;if(y(s)){const e=s.rings;s.rings=e}else if(b(s)){const e=s.paths;s.paths=e}else if(S(s)){const i=await this._getSymbolForGraphic(e,t);if(h(this._controller.signal),J(i.type)||Z(i.type)){s=s.center}else s=K(s)}await U(s.spatialReference,this.view.spatialReference);const i=v(s),r=G(i,s.spatialReference,this.view.spatialReference);return _(r),r}_onTileUpdate(e){const t=I(this.view.spatialReference);if(e.added&&e.added.length>0)for(const s of e.added)this._addNewTile(s,t);if(e.removed&&e.removed.length>0)for(const s of e.removed)this._removeTile(s.key)}async _addGraphic(e){this._abortProcessingGraphic(e.uid),h(this._controller.signal);const t=new AbortController;this._graphicIdToAbortController.set(e.uid,t);const s={signal:t.signal};try{await this._addOrUpdateGraphic(e,s),h(this._controller.signal),this._graphicIdToAbortController.delete(e.uid)}catch(i){if(this._graphicIdToAbortController.delete(e.uid),!n(i))throw i}}_updateGraphic(e,t){h(this._controller.signal);const s=this._projectAndNormalizeGeometry(e,t),i=this._getSymbolResources(e,t);return Promise.all([s,i]).then((([t,s])=>{h(this._controller.signal),this._graphicStore.addOrModify(e,s,t)}))}_addOrUpdateGraphic(e,t){h(this._controller.signal);const s=this._projectAndNormalizeGeometry(e,t),i=this._getSymbolResources(e,t);return Promise.all([s,i]).then((([t,s])=>{h(this._controller.signal),this._graphicsSet.has(e)&&this._graphicStore.addOrModify(e,s,t)}))}_addTile(e){const t=this.view.featuresTilingScheme.getTileBounds(u(),e),s=new R(e,t[0],t[3]);return this._tiles.set(e,s),this.container.addChild(s),s}async _addNewTile(e,t){const s=this._addTile(e.key),i=this._graphicStore.queryTileData(this._templateStore,e);if(0===i.length)return;if(t){const s=Math.round((t.valid[1]-t.valid[0])/e.resolution);for(const e of i)e.geometry&&(w(e.geometry)||T(e.geometry))&&this._wrapPoints(e,s)}const r=e.key;this._tileUpdateSet.add(e.key),this.notifyChange("updating");try{const t={type:"update",clear:!1,addOrUpdate:await this._processGraphics(e,i),remove:[],end:!0,sort:!1};s.patch(t),this._tileUpdateSet.delete(r),this.notifyChange("updating")}catch(o){if(this._tileUpdateSet.delete(r),this.notifyChange("updating"),!n(o))throw o}}_removeTile(e){if(!this._tiles.has(e))return;const t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_setFilterState(e,t){const s=this._displayIds.get(e),i=this._attributeStore.getHighlightFlag(e);this._attributeStore.setData(s,0,0,i|(t?x:0))}_getGraphicsData(e,t,s){const i=this.view,r=I(i.spatialReference),o=this._graphicStore.getGraphicsData(e,t,s);if(r){const e=Math.round((r.valid[1]-r.valid[0])/t.resolution);for(const t of o)t.geometry&&(w(t.geometry)||T(t.geometry))&&this._wrapPoints(t,e)}return o}_wrapPoints(e,t){const s=e.geometry;T(s)?this._wrapMultipoint(s,t):this._wrapPoint(e,t)}_wrapMultipoint(e,t){const s=e.points,i=[];let r=0,o=0;for(const[a,h]of s){if(i.push([a+r,h]),r=0,t===Q){const e=5*X;a+o<e?(i.push([t,0]),r=-t):a+o>Q-e&&(i.push([-t,0]),r=t)}else a+o<-X?(i.push([t,0]),r=-t):a+o>Q+X&&(i.push([-t,0]),r=t);o+=a}e.points=i}_wrapPoint(e,t){const s=e.geometry;if(t===Q){const i=5*X;s.x<i?e.geometry={points:[[s.x,s.y],[t,0]]}:s.x>Q-i&&(e.geometry={points:[[s.x,s.y],[-t,0]]})}else s.x<-X?e.geometry={points:[[s.x,s.y],[t,0]]}:s.x>Q+X&&(e.geometry={points:[[s.x,s.y],[-t,0]]})}_processGraphics(e,t,s){if(!(t&&t.length)||!this._meshFactory)return null;const i=B.from(t,this.uid),r=this._meshFactory;return this._matcher.then((t=>r.analyzeGraphics(i,this.container.stage.resourceManager,t,null,null,s).then((()=>(this._attributeStore.sendUpdates(),this._processAnalyzedGraphics(e,i))))))}_processAnalyzedGraphics(e,t){const s=this._meshFactory,i=t.getSize(),r=t.getCursor(),o={features:i,records:i,metrics:0},a=new F(e.key.id,o,A.DEFAULT,!1,!1),h=[];for(;r.next();){const t=r.readGraphic();t.insertAfter=-1===t.insertAfter?-1:this._displayIds.get(t.insertAfter),t.displayId=this._displayIds.get(t.attributes[this.uid]);const i=new D(t.displayId);i.insertAfter=t.insertAfter,h.push(i),s.writeGraphic(a,r,e.level,this.container.stage.resourceManager)}const n=e.tileInfoView.tileInfo.isWrappable,l=a.serialize(n);if(1!==l.length)return new q;const d=l[0].message;return q.fromVertexData(d,h)}_abortProcessingGraphic(e){if(this._graphicIdToAbortController.has(e)){this._graphicIdToAbortController.get(e).abort()}}_getNullSymbol(e){const t=e.geometry;return b(t)?C:y(t)||S(t)?j:P}_flipUpdatingGraphics(){this._updatingGraphicsTimer&&clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=setTimeout((()=>{this._updatingGraphicsTimer=null,this.notifyChange("updating")}),160),this.notifyChange("updating")}};e([d({constructOnly:!0})],re.prototype,"requestUpdateCallback",void 0),e([d()],re.prototype,"container",void 0),e([d({constructOnly:!0})],re.prototype,"graphics",void 0),e([d()],re.prototype,"updating",null),e([d()],re.prototype,"view",void 0),e([d()],re.prototype,"updateRequested",void 0),re=e([p("esri.views.2d.layers.support.GraphicsView2D")],re);const oe=re;export{oe as default};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{bidiText as s}from"../../../../core/BidiText.js";import{HandleOwnerMixin as i}from"../../../../core/HandleOwner.js";import r from"../../../../core/has.js";import{isSome as o,isNone as a}from"../../../../core/maybe.js";import{throwIfAborted as h,isAbortError as n,throwIfAbortError as l}from"../../../../core/promiseUtils.js";import{watch as d}from"../../../../core/reactiveUtils.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import g from"../../../../geometry/SpatialReference.js";import{width as m,height as u,create as _}from"../../../../geometry/support/aaBoundingRect.js";import{closeRingsAndFixWinding as f}from"../../../../geometry/support/coordsUtils.js";import{getJsonType as y,isPolygon as b,isPolyline as S,isExtent as w,isPoint as T,isMultipoint as v}from"../../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridianSync as I}from"../../../../geometry/support/normalizeUtilsSync.js";import{getInfo as U}from"../../../../geometry/support/spatialReferenceUtils.js";import{checkProjectionSupport as G,project as M}from"../../../../layers/graphics/data/projectionSupport.js";import{symbolToCIM as j}from"../../../../symbols/cim/CIMSymbolHelper.js";import{errorPolylineSymbol2D as C,errorPolygonSymbol2D as P,errorPointSymbol2D as x}from"../../../../symbols/support/defaults.js";import{FILTER_FLAG_0 as A}from"../../engine/webgl/definitions.js";import{WGLSymbologyType as R}from"../../engine/webgl/enums.js";import{GraphicTile as q}from"../../engine/webgl/GraphicTile.js";import{TileData as D}from"../../engine/webgl/TileData.js";import F from"../../engine/webgl/WGLDisplayObject.js";import{MeshData as O}from"../../engine/webgl/mesh/MeshData.js";import{WGLMeshFactory as z}from"../../engine/webgl/mesh/factories/WGLMeshFactory.js";import{WGLTemplateStore as H}from"../../engine/webgl/mesh/templates/WGLTemplateStore.js";import{createMatcher as k}from"../../engine/webgl/util/Matcher.js";import{createMatcherSchema as E,createSymbolSchemaOptions as N}from"../features/schemaUtils.js";import V from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as B}from"../features/support/ComputedAttributeStorage.js";import{GraphicsReader as L}from"../features/support/GraphicsReader.js";import W from"./GraphicStore.js";import{intersectingInternationalDateline as J,isMarkerSymbol as Z,isTextSymbol as K,polygonFromExtent as Q,TILE_SIZE as X,PIXEL_BUFFER as Y}from"./graphicsUtils.js";import{expandSymbol as $}from"../support/cimSymbolUtils.js";import{GraphicsView as ee}from"../../../layers/GraphicsView.js";import{getWebGLCapabilities as te}from"../../../webgl/capabilities.js";import{createSymbolSchema as se}from"../features/createSymbolSchema.js";const ie=r("esri-2d-graphic-debug");function re(e,t,s){if(s.has(e))return s.get(e);const i={tile:t,addedOrModified:[],removed:[]};return s.set(e,i),i}let oe=class extends(ee(i(t))){constructor(e){super(e),this._storage=new B,this._displayIds=new Map,this._controller=new AbortController,this._tiles=new Map,this._graphicStoreUpdate=!1,this._graphicsSet=new Set,this._matcher=Promise.resolve(null),this._tileUpdateSet=new Set,this._tilesToUpdate=new Map,this._graphicIdToAbortController=new Map,this._attached=!1,this._updatingGraphicsTimer=null,this._hashToExpandedSymbol=new Map,this._hashToExpandedSymbolPromise=new Map,this._hashToCIMSymbolPromise=new Map,this._hashToCIM=new Map,this._processing=!1,this._needsProcessing=!1,this._pendingUpdate={added:new Set,updated:new Set,removed:new Set},this.lastUpdateId=-1,this.updateRequested=!1,this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this._updatingGraphicsTimer&&(clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=null,this.notifyChange("updating")),this._controller.abort(),this.container.destroy(),this._set("graphics",null),this._graphicStore.clear(),this._attributeStore=null,this._hashToExpandedSymbol.clear(),this.view=null,this.renderer=null,this._hashToCIM.clear(),this._hashToCIMSymbolPromise.clear(),this._hashToExpandedSymbolPromise.clear()}_createMatcher(e,t,s){if(e){const i=E({indexCount:0,fields:{}},"feature",e);this._matcher=k(i,t,null,s)}}_createDisplayId(e){return this._displayIds.has(e)||this._displayIds.set(e,this._storage.createDisplayId()),this._displayIds.get(e)}initialize(){this._attributeStore=new V({type:"local",initialize:e=>Promise.resolve(this.container.attributeView.initialize(e)),update:e=>this.container.attributeView.requestUpdate(e),render:()=>this.container.requestRender()},te("2d")),this.container.hasHighlight=()=>this._attributeStore.hasHighlight;const e=e=>{this._createDisplayId(e.uid),this._setFilterState(e.uid,e.visible)},t=e=>{const t=this._displayIds.get(e.uid);this._displayIds.delete(e.uid),this._storage.releaseDisplayId(t)},s=new H(this.container.getMaterialItems.bind(this.container),this.view.featuresTilingScheme.tileInfo);this._graphicStore=new W(this.view.featuresTilingScheme,this.view.state.scale,this.uid,this.graphics,e,t,this._hashToCIM),this._meshFactory=new z(null,this.uid,s),this._templateStore=s,this.handles.add([d((()=>this.renderer),(e=>{this._createMatcher(e,s,this.container.stage.resourceManager);for(const t of this.graphics)this._pendingUpdate.updated.add(t);this.requestUpdate()})),this.view.graphicsTileStore.on("update",(e=>this._onTileUpdate(e))),this.container.on("attach",(()=>{ie&&this.container.enableRenderingBounds((()=>this._graphicStore.getAllBounds())),this.graphics.items.length>0&&this._graphicsChangeHandler({target:this.graphics,added:this.graphics.items,removed:[],moved:[]}),this.handles.add(this.graphics.on("change",(e=>this._graphicsChangeHandler(e))),"graphics");const e=this.container.stage.resourceManager;this._createMatcher(this.renderer,s,e),this._graphicStore.setResourceManager(e),this._attached=!0,this.notifyChange("updating")}))]);const i=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:i,removed:[]})}get updating(){return!this._attached||null!==this._updatingGraphicsTimer||this._tileUpdateSet.size>0||this._tilesToUpdate.size>0}hitTest(e){if(!this.view||!this.view.position)return null;const{resolution:t,rotation:s}=this.view.state;return this._graphicStore.hitTest(e.x,e.y,2,t,s)}update(e){h(this._controller.signal);const t=e.state,{resolution:s}=t;if(this._graphicStore.updateLevel(s),this._graphicStoreUpdate=!0,this.updateRequested=!1,this._pendingUpdate.updated.size>0){if(!this._processing)return void this._updateGraphics();this._needsProcessing=!0}}viewChange(){this.requestUpdate()}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback())}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}graphicUpdateHandler(e){const{graphic:t,property:s,newValue:i}=e;switch(s){case"attributes":case"geometry":case"symbol":this._pendingUpdate.updated.add(t),this.requestUpdate();break;case"visible":this._setFilterState(t.uid,i),this._attributeStore.sendUpdates()}}setHighlight(e){const t=e.map((e=>this._displayIds.get(e)));this._attributeStore.setHighlight(e,t)}_getIntersectingTiles(e){const t=this._graphicStore.getBounds(e);if(!t||0===m(t)||0===u(t))return[];const s=J(t,this.view.spatialReference);return o(s)?[...new Set([...this.view.graphicsTileStore.boundsIntersections(s[0]),...this.view.graphicsTileStore.boundsIntersections(s[1])])]:this.view.graphicsTileStore.boundsIntersections(t)}async _updateTile(e){h(this._controller.signal);const t=e.tile,s=this._getGraphicsData(this._templateStore,t,e.addedOrModified),i=await this._processGraphics(t,s);return h(this._controller.signal),this._patchTile(t.key,{type:"update",addOrUpdate:i,remove:e.removed,end:!0,clear:!1,sort:!1}),i}_patchTile(e,t){if(!this._tiles.has(e))return;const s=this._tiles.get(e);this.container.onTileData(s,t),this.container.requestRender()}_graphicsChangeHandler(e){const t=this._pendingUpdate;for(const s of e.added)t.added.add(s);for(const s of e.moved)t.updated.add(s);for(const s of e.removed)this._pendingUpdate.added.has(s)?t.added.delete(s):t.removed.add(s);this._processing?this._needsProcessing=!0:this._updateGraphics()}_getGraphicsToUpdate(){const e={added:[],removed:[],updated:[]};if(!this.graphics)return e;const t=this._pendingUpdate;for(const s of this.graphics.items)t.added.has(s)?e.added.push(s):t.updated.has(s)&&e.updated.push(s);for(const s of t.removed)this._graphicStore.has(s)&&e.removed.push(s);return t.added.clear(),t.removed.clear(),t.updated.clear(),e}async _updateGraphics(){this._processing=!0;const{added:e,removed:t,updated:s}=this._getGraphicsToUpdate(),i=this._tilesToUpdate;let r;try{if(!this._graphicStoreUpdate){const e=this.view.state,{resolution:t}=e;this._graphicStore.updateLevel(t)}const o=[],a=new Array(e.length+t.length);for(let e=0;e<s.length;e++){const t=s[e],h=this._getIntersectingTiles(t);for(const e of h){r=e.id;re(r,e,i).removed.push(this._displayIds.get(t.uid))}o.push(this._updateGraphic(t,null)),a[e]=t}const h=s.length;for(let t=0;t<e.length;t++){const s=e[t];a[h+t]=s,this._graphicsSet.add(s),o.push(this._addGraphic(s))}for(const e of t){this._abortProcessingGraphic(e.uid);const t=this._getIntersectingTiles(e);for(const s of t){r=s.id;re(r,s,i).removed.push(this._displayIds.get(e.uid))}this._graphicsSet.delete(e),this._graphicStore.remove(e)}let n;this._flipUpdatingGraphics(),await Promise.all(o);for(let e=0;e<a.length;e++){n=a[e];const t=this._getIntersectingTiles(n);for(const e of t){r=e.id;re(r,e,i).addedOrModified.push(n)}}this._graphicStore.updateZ();const l=[];for(const[e,t]of i)l.push(this._updateTile(t));await Promise.all(l)}catch(o){n(o),0}for(const a of t)try{const e=await this._getSymbolForGraphic(a,{});if(e){const t=e.hash();this._hashToExpandedSymbol.delete(t)}}catch(o){n(o),0}i.clear(),this.notifyChange("updating"),this._processing=!1,this._needsProcessing&&(this._needsProcessing=!1,this._updateGraphics())}_getArcadeInfo(e){const t=(e.attributes?Object.keys(e.attributes):[]).map((t=>({name:t,alias:t,type:"string"==typeof e.attributes[t]?"esriFieldTypeString":"esriFieldTypeDouble"})));return a(e.geometry)?null:{geometryType:y(e.geometry),spatialReference:g.fromJSON(e.geometry.spatialReference),fields:t}}_getSymbolForGraphic(e,t){return h(this._controller.signal),o(e.symbol)?Promise.resolve(e.symbol):o(this.renderer)?this.renderer.getSymbolAsync(e,{scale:this.view.scale,abortOptions:t}):Promise.resolve(this._getNullSymbol(e))}_getCIMSymbol(e,t,s){let i=this._hashToCIM.get(t);if(i)return Promise.resolve(i);const r=j(e);if(o(r)){if("CIMSymbolReference"===r.type)return i=r,this._hashToCIM.set(t,i),Promise.resolve(i);let e=this._hashToCIMSymbolPromise.get(t);return e||(e=r.fetchCIMSymbol(s).then((e=>(this._hashToCIM.set(t,e.data),this._hashToCIMSymbolPromise.delete(t),e))).catch((e=>(this._hashToCIMSymbolPromise.delete(t),l(e),null))),this._hashToCIMSymbolPromise.set(t,e),e)}return Promise.resolve(null)}_expandCIMSymbol(e,t,s,i){const r=this._hashToExpandedSymbol.get(s);if(r)return Promise.resolve(r);let o=this._hashToExpandedSymbolPromise.get(s);if(o)return o;const a=this.container.stage,h=this._getArcadeInfo(t),n=N(null),l=se(e,n);return o=$(l,h,a.resourceManager,i),this._hashToExpandedSymbolPromise.set(s,o),o.then((e=>(this._hashToExpandedSymbol.set(s,e),this._hashToExpandedSymbolPromise.delete(s),e))),o}async _getSymbolResources(e,t){h(this._controller.signal);return this.container.stage?this._getSymbolForGraphic(e,t).then((i=>{const r=i.hash();return this._getCIMSymbol(i,r,t).then((i=>a(i)?null:this._expandCIMSymbol(i,e,r,t).then((e=>{const t=e.layers.filter((e=>"text"===e.type&&"string"==typeof e.text));if(t&&t.length>0){const i=new Array(t.length);for(let e=0;e<t.length;e++){const r=t[e],o=[],[a]=s(r.text);r.text=a;for(let e=0;e<a.length;e++)o.push(a.charCodeAt(e));i[e]={symbol:r,id:e,glyphIds:o}}const o=new Map;return this.container.getMaterialItems(i).then((s=>{for(let e=0;e<t.length;e++){const i=t[e];o.set(i.cim,{text:i.text,mosaicItem:s[e].mosaicItem})}return{symbol:e,textInfo:o,hash:r}}))}return{symbol:e,hash:r}}))))})).catch((e=>(l(e),null))):null}async _projectAndNormalizeGeometry(e,t){if(h(this._controller.signal),a(e.geometry)||"mesh"===e.geometry.type)return null;let s=e.geometry;if(b(s)){const e=s.rings;s.rings=e}else if(S(s)){const e=s.paths;s.paths=e}else if(w(s)){const i=await this._getSymbolForGraphic(e,t);if(h(this._controller.signal),Z(i.type)||K(i.type)){s=s.center}else s=Q(s)}await G(s.spatialReference,this.view.spatialReference);const i=I(s),r=M(i,s.spatialReference,this.view.spatialReference);return f(r),r}_onTileUpdate(e){const t=U(this.view.spatialReference);if(e.added&&e.added.length>0)for(const s of e.added)this._addNewTile(s,t);if(e.removed&&e.removed.length>0)for(const s of e.removed)this._removeTile(s.key)}async _addGraphic(e){this._abortProcessingGraphic(e.uid),h(this._controller.signal);const t=new AbortController;this._graphicIdToAbortController.set(e.uid,t);const s={signal:t.signal};try{await this._addOrUpdateGraphic(e,s),h(this._controller.signal),this._graphicIdToAbortController.delete(e.uid)}catch(i){if(this._graphicIdToAbortController.delete(e.uid),!n(i))throw i}}_updateGraphic(e,t){h(this._controller.signal);const s=this._projectAndNormalizeGeometry(e,t),i=this._getSymbolResources(e,t);return Promise.all([s,i]).then((([t,s])=>{h(this._controller.signal),this._graphicStore.addOrModify(e,s,t)}))}_addOrUpdateGraphic(e,t){h(this._controller.signal);const s=this._projectAndNormalizeGeometry(e,t),i=this._getSymbolResources(e,t);return Promise.all([s,i]).then((([t,s])=>{h(this._controller.signal),this._graphicsSet.has(e)&&this._graphicStore.addOrModify(e,s,t)}))}_addTile(e){const t=this.view.featuresTilingScheme.getTileBounds(_(),e),s=new q(e,t[0],t[3]);return this._tiles.set(e,s),this.container.addChild(s),s}async _addNewTile(e,t){const s=this._addTile(e.key),i=this._graphicStore.queryTileData(this._templateStore,e);if(0===i.length)return;if(t){const s=Math.round((t.valid[1]-t.valid[0])/e.resolution);for(const e of i)e.geometry&&(T(e.geometry)||v(e.geometry))&&this._wrapPoints(e,s)}const r=e.key;this._tileUpdateSet.add(e.key),this.notifyChange("updating");try{const t={type:"update",clear:!1,addOrUpdate:await this._processGraphics(e,i),remove:[],end:!0,sort:!1};s.patch(t),this._tileUpdateSet.delete(r),this.notifyChange("updating")}catch(o){if(this._tileUpdateSet.delete(r),this.notifyChange("updating"),!n(o))throw o}}_removeTile(e){if(!this._tiles.has(e))return;const t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_setFilterState(e,t){const s=this._displayIds.get(e),i=this._attributeStore.getHighlightFlag(e);this._attributeStore.setData(s,0,0,i|(t?A:0))}_getGraphicsData(e,t,s){const i=this.view,r=U(i.spatialReference),o=this._graphicStore.getGraphicsData(e,t,s);if(r){const e=Math.round((r.valid[1]-r.valid[0])/t.resolution);for(const t of o)t.geometry&&(T(t.geometry)||v(t.geometry))&&this._wrapPoints(t,e)}return o}_wrapPoints(e,t){const s=e.geometry;v(s)?this._wrapMultipoint(s,t):this._wrapPoint(e,t)}_wrapMultipoint(e,t){const s=e.points,i=[];let r=0,o=0;for(const[a,h]of s){if(i.push([a+r,h]),r=0,t===X){const e=5*Y;a+o<e?(i.push([t,0]),r=-t):a+o>X-e&&(i.push([-t,0]),r=t)}else a+o<-Y?(i.push([t,0]),r=-t):a+o>X+Y&&(i.push([-t,0]),r=t);o+=a}e.points=i}_wrapPoint(e,t){const s=e.geometry;if(t===X){const i=5*Y;s.x<i?e.geometry={points:[[s.x,s.y],[t,0]]}:s.x>X-i&&(e.geometry={points:[[s.x,s.y],[-t,0]]})}else s.x<-Y?e.geometry={points:[[s.x,s.y],[t,0]]}:s.x>X+Y&&(e.geometry={points:[[s.x,s.y],[-t,0]]})}_processGraphics(e,t,s){if(!(t&&t.length)||!this._meshFactory)return null;const i=L.from(t,this.uid),r=this._meshFactory;return this._matcher.then((t=>r.analyzeGraphics(i,this.container.stage.resourceManager,t,null,null,s).then((()=>(this._attributeStore.sendUpdates(),this._processAnalyzedGraphics(e,i))))))}_processAnalyzedGraphics(e,t){const s=this._meshFactory,i=t.getSize(),r=t.getCursor(),o={features:i,records:i,metrics:0},a=new O(e.key.id,o,R.DEFAULT,!1,!1),h=[];for(;r.next();){const t=r.readGraphic();t.insertAfter=-1===t.insertAfter?-1:this._displayIds.get(t.insertAfter),t.displayId=this._displayIds.get(t.attributes[this.uid]);const i=new F(t.displayId);i.insertAfter=t.insertAfter,h.push(i),s.writeGraphic(a,r,e.level,this.container.stage.resourceManager)}const n=e.tileInfoView.tileInfo.isWrappable,l=a.serialize(n);if(1!==l.length)return new D;const d=l[0].message;return D.fromVertexData(d,h)}_abortProcessingGraphic(e){if(this._graphicIdToAbortController.has(e)){this._graphicIdToAbortController.get(e).abort()}}_getNullSymbol(e){const t=e.geometry;return S(t)?C:b(t)||w(t)?P:x}_flipUpdatingGraphics(){this._updatingGraphicsTimer&&clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=setTimeout((()=>{this._updatingGraphicsTimer=null,this.notifyChange("updating")}),160),this.notifyChange("updating")}};e([p({constructOnly:!0})],oe.prototype,"requestUpdateCallback",void 0),e([p()],oe.prototype,"container",void 0),e([p({constructOnly:!0})],oe.prototype,"graphics",void 0),e([p()],oe.prototype,"updating",null),e([p()],oe.prototype,"view",void 0),e([p()],oe.prototype,"updateRequested",void 0),oe=e([c("esri.views.2d.layers.support.GraphicsView2D")],oe);const ae=oe;export{ae 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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import i from"../../../../core/has.js";import t from"../../../../core/Logger.js";import{isNone as r}from"../../../../core/maybe.js";import{createMD5Hash as s}from"../../../../core/MD5.js";import a from"../../../../renderers/visualVariables/SizeVariable.js";import n from"../../../../renderers/visualVariables/support/SizeStop.js";import{LevelDependentSizeVariable as l}from"../../engine/LevelDependentSizeVariable.js";const o=t.getLogger("esri.views.2d.layers.support.clusterUtils");i.add("esri-cluster-arcade-enabled",!0);const u=i("esri-cluster-arcade-enabled"),c=(e,i,t,s)=>{const a=i.clone();if(!m(a))return a;if(t.fields)for(const r of t.fields)x(e,r);if("visualVariables"in a){const i=(a.visualVariables||[]).filter((e=>"$view.scale"!==e.valueExpression)),n=d(i);i.forEach((i=>{"rotation"===i.type?i.field?i.field=y(e,i.field,"avg_angle"):i.valueExpression&&(i.field=S(e,i.valueExpression,"avg_angle"),i.valueExpression=null):i.normalizationField?(i.field=y(e,i.field,"norm",i.normalizationField),i.normalizationField=null):i.field?i.field=y(e,i.field,"avg"):(i.field=S(e,i.valueExpression,"avg"),i.valueExpression=null)})),r(n)&&!p(i)&&(i.push(f(t,s)),a.dynamicClusterSize=!0),a.visualVariables=i}switch(a.type){case"simple":break;case"unique-value":a.field?a.field=y(e,a.field,"mode"):a.valueExpression&&(a.field=S(e,a.valueExpression,"mode"),a.valueExpression=null);break;case"class-breaks":a.normalizationField?(a.field=y(e,a.field,"norm",a.normalizationField),a.normalizationField=null):a.field?a.field=y(e,a.field,"avg"):(a.field=S(e,a.valueExpression,"avg"),a.valueExpression=null)}return a},d=e=>{for(const i of e)if("size"===i.type)return i;return null},p=e=>{for(const i of e)if("cluster_count"===i.field)return!0;return!1},f=(e,i)=>{const t=[new n({value:0,size:0}),new n({value:1})];if(r(i))return new a({field:"cluster_count",stops:[...t,new n({value:2,size:0})]});const s=Object.keys(i).reduce(((r,s)=>({...r,[s]:[...t,new n({value:Math.max(2,i[s].minValue),size:e.clusterMinSize}),new n({value:Math.max(3,i[s].maxValue),size:e.clusterMaxSize})]})),{});return new l({field:"cluster_count",levels:s})},m=i=>{const t=t=>o.error(new e("Unsupported-renderer",t,{renderer:i}));if("unique-value"===i.type){if(i.field2||i.field3)return t("FeatureReductionCluster does not support multi-field UniqueValueRenderers"),!1}else if("class-breaks"===i.type){if(i.normalizationField){const e=i.normalizationType;if("field"!==e)return t(`FeatureReductionCluster does not support a normalizationType of ${e}`),!1}}else if("simple"!==i.type)return t(`FeatureReductionCluster does not support renderers of type ${i.type}`),!1;if(!u){if("valueExpression"in i&&i.valueExpression)return t("FeatureReductionCluster does not currently support renderer.valueExpression. Support will be added in a future release"),!1;if(("visualVariables"in i&&i.visualVariables||[]).some((e=>!(!("valueExpression"in e)||!e.valueExpression))))return t("FeatureReductionCluster does not currently support visualVariables with a valueExpression. Support will be added in a future release"),!1}return!0};function v(e,i,t){switch(e){case"avg":case"avg_angle":return`cluster_avg_${i}`;case"mode":return`cluster_type_${i}`;case"norm":{const e=t,r="field",a=i.toLowerCase()+",norm:"+r+","+e.toLowerCase();return"cluster_avg_"+s(a)}}}function x(i,t){const{name:r,outStatistic:a}=t,{onStatisticField:n,onStatisticValueExpression:l,statisticType:u}=a;if(l){const e=s(l.toLowerCase());i.push({name:r,outStatistic:{onStatisticField:e,onStatisticValueExpression:l,statisticType:u}})}else n?i.push({name:r,outStatistic:{onStatisticField:n,statisticType:u}}):o.error(new e("mapview-unsupported-field","Unable to handle field",{field:t}))}function S(e,i,t){const r=s(i),a="mode"===t?`cluster_type_${r}`:`cluster_avg_${r}`;return e.some((e=>e.name===a))||e.push({name:a,outStatistic:{onStatisticField:r,onStatisticValueExpression:i,statisticType:t}}),a}function y(e,i,t,r){if("cluster_count"===i||e.some((e=>e.name===i)))return i;const s=v(t,i,r);return e.some((e=>e.name===s))||("norm"===t?e.push({name:s,outStatistic:{onStatisticField:i,onStatisticNormalizationField:r,statisticType:t}}):e.push({name:s,outStatistic:{onStatisticField:i,statisticType:t}})),s}export{f as createClusterCountSizeVariable,c as createClusterRenderer,d as findSizeVV,p as hasClusterCountVV,m as isClusterCompatibleRenderer};
|
|
5
|
+
import e from"../../../../core/Error.js";import i from"../../../../core/has.js";import t from"../../../../core/Logger.js";import{isNone as r}from"../../../../core/maybe.js";import{createMD5Hash as s}from"../../../../core/MD5.js";import a from"../../../../renderers/visualVariables/SizeVariable.js";import n from"../../../../renderers/visualVariables/support/SizeStop.js";import{LevelDependentSizeVariable as l}from"../../engine/LevelDependentSizeVariable.js";const o=t.getLogger("esri.views.2d.layers.support.clusterUtils");i.add("esri-cluster-arcade-enabled",!0);const u=i("esri-cluster-arcade-enabled"),c=(e,i,t,s)=>{const a=i.clone();if(!m(a))return a;if(t.fields)for(const r of t.fields)x(e,r);if("visualVariables"in a){const i=(a.visualVariables||[]).filter((e=>"$view.scale"!==e.valueExpression)),n=d(i);i.forEach((i=>{"rotation"===i.type?i.field?i.field=y(e,i.field,"avg_angle"):i.valueExpression&&(i.field=S(e,i.valueExpression,"avg_angle"),i.valueExpression=null):i.normalizationField?(i.field=y(e,i.field,"norm",i.normalizationField),i.normalizationField=null):i.field?i.field=y(e,i.field,"avg"):(i.field=S(e,i.valueExpression,"avg"),i.valueExpression=null)})),r(n)&&!p(i)&&(i.push(f(t,s)),a.dynamicClusterSize=!0),a.visualVariables=i}switch(a.type){case"simple":break;case"unique-value":a.field?a.field=y(e,a.field,"mode"):a.valueExpression&&(a.field=S(e,a.valueExpression,"mode"),a.valueExpression=null);break;case"class-breaks":a.normalizationField?(a.field=y(e,a.field,"norm",a.normalizationField),a.normalizationField=null):a.field?a.field=y(e,a.field,"avg"):(a.field=S(e,a.valueExpression,"avg"),a.valueExpression=null)}return a},d=e=>{for(const i of e)if("size"===i.type)return i;return null},p=e=>{for(const i of e)if("cluster_count"===i.field)return!0;return!1},f=(e,i)=>{const t=[new n({value:0,size:0}),new n({value:1})];if(r(i))return new a({field:"cluster_count",stops:[...t,new n({value:2,size:0})]});const s=Object.keys(i).reduce(((r,s)=>({...r,[s]:[...t,new n({value:Math.max(2,i[s].minValue),size:e.clusterMinSize}),new n({value:Math.max(3,i[s].maxValue),size:e.clusterMaxSize})]})),{});return new l({field:"cluster_count",levels:s})},m=i=>{const t=t=>o.error(new e("Unsupported-renderer",t,{renderer:i}));if("unique-value"===i.type){if(i.field2||i.field3)return t("FeatureReductionCluster does not support multi-field UniqueValueRenderers"),!1}else if("class-breaks"===i.type){if(i.normalizationField){const e=i.normalizationType;if("field"!==e)return t(`FeatureReductionCluster does not support a normalizationType of ${e}`),!1}}else if("simple"!==i.type)return t(`FeatureReductionCluster does not support renderers of type ${i.type}`),!1;if(!u){if("valueExpression"in i&&i.valueExpression)return t("FeatureReductionCluster does not currently support renderer.valueExpression. Support will be added in a future release"),!1;if(("visualVariables"in i&&i.visualVariables||[]).some((e=>!(!("valueExpression"in e)||!e.valueExpression))))return t("FeatureReductionCluster does not currently support visualVariables with a valueExpression. Support will be added in a future release"),!1}return!0};function v(e,i,t){switch(e){case"avg":case"avg_angle":return`cluster_avg_${i}`;case"mode":return`cluster_type_${i}`;case"norm":{const e=t,r="field",a=i.toLowerCase()+",norm:"+r+","+e.toLowerCase();return"cluster_avg_"+s(a)}}}function x(i,t){const{name:r,outStatistic:a}=t,{onStatisticField:n,onStatisticValueExpression:l,statisticType:u}=a;if(l){const e=s(l.toLowerCase());i.push({name:r,outStatistic:{onStatisticField:e,onStatisticValueExpression:l,statisticType:u}})}else n?i.push({name:r,outStatistic:{onStatisticField:n,statisticType:u}}):o.error(new e("mapview-unsupported-field","Unable to handle field",{field:t}))}function S(e,i,t){const r=s(i),a="mode"===t?`cluster_type_${r}`:`cluster_avg_${r}`;return e.some((e=>e.name===a))||e.push({name:a,outStatistic:{onStatisticField:r,onStatisticValueExpression:i,statisticType:t}}),a}function y(e,i,t,r){if("cluster_count"===i||e.some((e=>e.name===i)))return i;const s=v(t,i,r);return e.some((e=>e.name===s))||("norm"===t?e.push({name:s,outStatistic:{onStatisticField:i,onStatisticNormalizationField:r,statisticType:t}}):e.push({name:s,outStatistic:{onStatisticField:i,statisticType:t}})),s}export{x as convertAggregateFieldFromPublic,f as createClusterCountSizeVariable,c as createClusterRenderer,d as findSizeVV,p as hasClusterCountVV,m as isClusterCompatibleRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../request.js";import r from"../../../core/Handles.js";import{clamp as t}from"../../../core/mathUtils.js";import{isNone as
|
|
5
|
+
import e from"../../../request.js";import r from"../../../core/Handles.js";import{equalsShallow as s}from"../../../core/lang.js";import{clamp as t}from"../../../core/mathUtils.js";import{isNone as i,isSome as a,disposeMaybe as o}from"../../../core/maybe.js";import{createTask as n}from"../../../core/promiseUtils.js";import{watch as l,initial as h}from"../../../core/reactiveUtils.js";import{isSVG as m}from"../../../core/urlUtils.js";import{c as u}from"../../../chunks/mat3f32.js";import{DisplayObject as c}from"../engine/DisplayObject.js";import{Pos2us as d}from"../engine/webgl/DefaultVertexAttributeLayouts.js";import{WGLDrawPhase as _}from"../engine/webgl/enums.js";import{createMagnifierProgram as p,magnifierProgramTemplate as f}from"../engine/webgl/shaders/MagnifierPrograms.js";import{loadMagnifierResources as g}from"../../magnifier/resources.js";import{BufferObject as T}from"../../webgl/BufferObject.js";import{PrimitiveType as b,Usage as x,TextureType as R,PixelFormat as y,PixelType as k,TextureWrapMode as A,TextureSamplingMode as v}from"../../webgl/enums.js";import{Texture as E}from"../../webgl/Texture.js";import{VertexArrayObject as j}from"../../webgl/VertexArrayObject.js";class w extends c{constructor(){super(),this._handles=new r,this._resourcePixelRatio=1,this.visible=!1}destroy(){this._handles.destroy(),this._handles=null,this._disposeRenderResources(),this._resourcesTask&&(this._resourcesTask.abort(),this._resourcesTask=null)}get background(){return this._background}set background(e){this._background=e,this.requestRender()}get magnifier(){return this._magnifier}set magnifier(e){this._magnifier=e,this._handles.removeAll(),this._handles.add([l((()=>e.version),(()=>{this.visible=e.visible&&a(e.position)&&e.size>0,this.requestRender()}),h),l((()=>[e.maskUrl,e.overlayUrl]),(()=>this._reloadResources()),{equals:s}),l((()=>e.size),(()=>{this._disposeRenderResources(),this.requestRender()}))])}_createTransforms(){return{dvs:u()}}doRender(e){const r=e.context;if(!this._resourcesTask)return void this._reloadResources();if(e.drawPhase!==_.MAP||!this._canRender())return;this._updateResources(e);const s=this._magnifier;if(i(s.position))return;const a=e.pixelRatio,o=s.size*a,n=1/s.factor,l=Math.ceil(n*o);this._readbackTexture.resize(l,l);const{size:h}=e.state,m=a*h[0],u=a*h[1],c=.5*l,d=.5*l,p=t(a*s.position.x,c,m-c-1),f=t(u-a*s.position.y,d,u-d-1);r.setBlendingEnabled(!0);const g=p-c,T=f-d,x=this._readbackTexture;r.bindTexture(x,0),r.gl.copyTexImage2D(x.descriptor.target,0,x.descriptor.pixelFormat,g,T,l,l,0);const R=this.background?.color,y=R?[R.a*R.r/255,R.a*R.g/255,R.a*R.b/255,R.a]:[1,1,1,1],k=(p+s.offset.x*a)/m*2-1,A=(f-s.offset.y*a)/u*2-1,v=o/m*2,E=o/u*2,j=this._program;r.bindVAO(this._vertexArrayObject),r.bindTexture(this._overlayTexture,6),r.bindTexture(this._maskTexture,7),r.useProgram(j),j.setUniform4fv("u_background",y),j.setUniform1i("u_readbackTexture",0),j.setUniform1i("u_overlayTexture",6),j.setUniform1i("u_maskTexture",7),j.setUniform4f("u_drawPos",k,A,v,E),j.setUniform1i("u_maskEnabled",s.maskEnabled?1:0),j.setUniform1i("u_overlayEnabled",s.overlayEnabled?1:0),r.setStencilTestEnabled(!1),r.setColorMask(!0,!0,!0,!0),r.drawArrays(b.TRIANGLE_STRIP,0,4),r.bindVAO()}_canRender(){return this.mask&&this.overlay&&null!=this._magnifier}_reloadResources(){this._resourcesTask&&this._resourcesTask.abort();const r=a(this._magnifier)?this._magnifier.maskUrl:null,s=a(this._magnifier)?this._magnifier.overlayUrl:null;this._resourcesTask=n((async t=>{const o=i(r)||i(s)?g(t):null,n=a(r)?e(r,{responseType:"image",signal:t}).then((e=>e.data)):o.then((e=>e.mask)),l=a(s)?e(s,{responseType:"image",signal:t}).then((e=>e.data)):o.then((e=>e.overlay)),[h,m]=await Promise.all([n,l]);this.mask=h,this.overlay=m,this._disposeRenderResources(),this.requestRender()}))}_disposeRenderResources(){this._readbackTexture=o(this._readbackTexture),this._overlayTexture=o(this._overlayTexture),this._maskTexture=o(this._maskTexture),this._vertexArrayObject=o(this._vertexArrayObject),this._program=o(this._program)}_updateResources(e){if(e.pixelRatio!==this._resourcePixelRatio&&this._disposeRenderResources(),this._readbackTexture)return;const r=e.context;this._resourcePixelRatio=e.pixelRatio;const s=Math.ceil(this._magnifier.size*e.pixelRatio);this._program=p(r);const t=new Uint16Array([0,1,0,0,1,1,1,0]),i=f.attributes;this._vertexArrayObject=new j(r,i,d,{geometry:T.createVertex(r,x.STATIC_DRAW,t)}),this.overlay.width=s,this.overlay.height=s,this._overlayTexture=new E(r,{target:R.TEXTURE_2D,pixelFormat:y.RGBA,internalFormat:y.RGBA,dataType:k.UNSIGNED_BYTE,wrapMode:A.CLAMP_TO_EDGE,samplingMode:v.NEAREST,flipped:!0,preMultiplyAlpha:!m(this.overlay.src)||!e.context.driverTest.svgAlwaysPremultipliesAlpha},this.overlay),this.mask.width=s,this.mask.height=s,this._maskTexture=new E(r,{target:R.TEXTURE_2D,pixelFormat:y.ALPHA,internalFormat:y.ALPHA,dataType:k.UNSIGNED_BYTE,wrapMode:A.CLAMP_TO_EDGE,samplingMode:v.NEAREST,flipped:!0},this.mask);const a=1/this._magnifier.factor;this._readbackTexture=new E(r,{target:R.TEXTURE_2D,pixelFormat:y.RGBA,internalFormat:y.RGBA,dataType:k.UNSIGNED_BYTE,wrapMode:A.CLAMP_TO_EDGE,samplingMode:v.LINEAR,flipped:!1,width:Math.ceil(a*s),height:Math.ceil(a*s)})}}export{w as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import o from"../../../../Viewpoint.js";import i from"../../../../core/Accessor.js";import{
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import o from"../../../../Viewpoint.js";import i from"../../../../core/Accessor.js";import{when as s}from"../../../../core/reactiveUtils.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as m,b as a}from"../../../../chunks/vec2.js";import{a as r}from"../../../../chunks/vec2f64.js";import{getPaddingScreenTranslation as h,scaleAndRotateBy as u}from"../../viewpointUtils.js";import{RotationMomentumEstimator as p}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as c}from"../../../navigation/ZoomMomentumEstimator.js";import l from"../../../../geometry/Point.js";let _=class extends i{constructor(t){super(t),this._animationTime=0,this._momentumFinished=!1,this._rotationMomentumEstimator=new p(.6,.15,.95),this._rotationDirection=1,this._zoomDirection=1,this._zoomMomentumEstimator=new c,this._zoomOnly=null,this.zoomMomentum=null,this.rotateMomentum=null,this.viewpoint=new o({targetGeometry:new l,scale:0,rotation:0}),this.own(s((()=>this._momentumFinished),(()=>this.navigation.stop())))}begin(t,o){this.navigation.begin(),this._rotationMomentumEstimator.reset(),this._zoomMomentumEstimator.reset(),this._zoomOnly=null,this._previousAngle=this._startAngle=o.angle,this._previousRadius=this._startRadius=o.radius,this._previousCenter=o.center,this._updateTimestamp=null,t.constraints.rotationEnabled&&this.addToRotateEstimator(0,o.timestamp),this.addToZoomEstimator(o,1)}update(t,o){null===this._updateTimestamp&&(this._updateTimestamp=o.timestamp);const i=o.angle,s=o.radius,e=o.center,n=Math.abs(180*(i-this._startAngle)/Math.PI),m=Math.abs(s-this._startRadius),a=this._startRadius/s;if(this._previousRadius){const r=s/this._previousRadius;let h=180*(i-this._previousAngle)/Math.PI;this._rotationDirection=h>=0?1:-1,this._zoomDirection=r>=1?1:-1,t.constraints.rotationEnabled?(null===this._zoomOnly&&o.timestamp-this._updateTimestamp>200&&(this._zoomOnly=m-n>0),null===this._zoomOnly||this._zoomOnly?h=0:this.addToRotateEstimator(i-this._startAngle,o.timestamp)):h=0,this.addToZoomEstimator(o,a),this.navigation.setViewpoint([e.x,e.y],1/r,h,[this._previousCenter.x-e.x,e.y-this._previousCenter.y])}this._previousAngle=i,this._previousRadius=s,this._previousCenter=e}end(t){this.rotateMomentum=this._rotationMomentumEstimator.evaluateMomentum(),this.zoomMomentum=this._zoomMomentumEstimator.evaluateMomentum(),this._animationTime=0,(this.rotateMomentum||this.zoomMomentum)&&this.onAnimationUpdate(t),this.navigation.end()}addToRotateEstimator(t,o){this._rotationMomentumEstimator.add(t,.001*o)}addToZoomEstimator(t,o){this._zoomMomentumEstimator.add(o,.001*t.timestamp)}canZoomIn(t){const o=t.scale,i=t.constraints.effectiveMaxScale;return 0===i||o>i}canZoomOut(t){const o=t.scale,i=t.constraints.effectiveMinScale;return 0===i||o<i}onAnimationUpdate(t){this.navigation.animationManager.animateContinous(t.viewpoint,((o,i)=>{const s=!this.canZoomIn(t)&&this._zoomDirection>1||!this.canZoomOut(t)&&this._zoomDirection<1,e=!this.rotateMomentum||this.rotateMomentum.isFinished(this._animationTime),n=s||!this.zoomMomentum||this.zoomMomentum.isFinished(this._animationTime),p=.001*i;if(this._momentumFinished=e&&n,!this._momentumFinished){const i=this.rotateMomentum?Math.abs(this.rotateMomentum.valueDelta(this._animationTime,p))*this._rotationDirection*180/Math.PI:0;let s=this.zoomMomentum?Math.abs(this.zoomMomentum.valueDelta(this._animationTime,p)):1;const e=r(),n=r();if(this._previousCenter){m(e,this._previousCenter.x,this._previousCenter.y),h(n,t.size,t.padding),a(e,e,n);const{constraints:r,scale:p}=t,c=p*s;s<1&&!r.canZoomInTo(c)?(s=p/r.effectiveMaxScale,this.zoomMomentum=null,this.rotateMomentum=null):s>1&&!r.canZoomOutTo(c)&&(s=p/r.effectiveMinScale,this.zoomMomentum=null,this.rotateMomentum=null),u(o,t.viewpoint,s,i,e,t.size),t.constraints.constrainByGeometry(o)}}this._animationTime+=p}))}stopMomentumNavigation(){(this.rotateMomentum||this.zoomMomentum)&&(this.rotateMomentum&&(this._rotationMomentumEstimator.reset(),this.rotateMomentum=null),this.zoomMomentum&&(this._zoomMomentumEstimator.reset(),this.zoomMomentum=null),this.navigation.stop())}};t([e()],_.prototype,"_momentumFinished",void 0),t([e()],_.prototype,"viewpoint",void 0),t([e()],_.prototype,"navigation",void 0),_=t([n("esri.views.2d.navigation.actions.Pinch")],_);const d=_;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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../Viewpoint.js";import e from"../../core/Collection.js";import{isSome as n,get as r,isNone as o}from"../../core/maybe.js";import{getMetersPerUnitForSR as a}from"../../core/unitUtils.js";import{t as i}from"../../chunks/common.js";import{f as c,r as s,t as u,a as f,s as l,i as m,b as y}from"../../chunks/mat2d.js";import{c as p}from"../../chunks/mat2df64.js";import{f as g,a as x,c as
|
|
5
|
+
import t from"../../Viewpoint.js";import e from"../../core/Collection.js";import{isSome as n,get as r,isNone as o}from"../../core/maybe.js";import{getMetersPerUnitForSR as a}from"../../core/unitUtils.js";import{t as i}from"../../chunks/common.js";import{f as c,r as s,t as u,a as f,s as l,i as m,b as y}from"../../chunks/mat2d.js";import{c as p}from"../../chunks/mat2df64.js";import{f as g,a as x,c as h,k as b,n as w,g as d,i as j,m as G,h as R,o as k,t as A,b as S}from"../../chunks/vec2.js";import{f as v,a as F}from"../../chunks/vec2f64.js";import N from"../../geometry/Extent.js";import z from"../../geometry/Geometry.js";import I from"../../geometry/Point.js";import{isLoaded as M,canProjectWithoutEngine as V,load as q,project as L}from"../../geometry/projection.js";import P from"../../geometry/SpatialReference.js";import{isValid as C,equals as E,getInfo as O}from"../../geometry/support/spatialReferenceUtils.js";const Q=96,U=39.37,B=180/Math.PI;function D(t){return t.wkid?t:t.spatialReference||P.WGS84}function T(t,e){return e.type?x(t,e.x,e.y):h(t,e)}function W(t){return a(t)}function H(t,e){return Math.max(t.width/e[0],t.height/e[1])*ct(t.spatialReference)}async function J(t,a,i,c){let s,u;if(!t)return null;if(Array.isArray(t)&&!t.length)return null;if(e.isCollection(t)&&(t=t.toArray()),Array.isArray(t)&&t.length&&"object"==typeof t[0]){const e=t.every((t=>"attributes"in t)),r=t.some((t=>!t.geometry));let o=t;if(e&&r&&a&&a.allLayerViews){const e=new Map;for(const n of t){const t=n.layer,r=e.get(t)||[],o=n.attributes[t.objectIdField];null!=o&&r.push(o),e.set(t,r)}const r=[];e.forEach(((t,e)=>{const n=a.allLayerViews.find((t=>t.layer.id===e.id));if("queryFeatures"in n){const o=e.createQuery();o.objectIds=t,o.returnGeometry=!0,r.push(n.queryFeatures(o))}}));const i=await Promise.all(r),c=[];for(const t of i)if(t&&t.features&&t.features.length)for(const e of t.features)n(e.geometry)&&c.push(e.geometry);o=c}for(const t of o)c=await J(t,a,i,c);return c}if(Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1])s=new I(t);else if(t instanceof z)s=t;else if("geometry"in t)if(t.geometry)s=t.geometry;else if(t.layer){const e=t.layer,n=a.allLayerViews.find((t=>t.layer.id===e.id));if("queryFeatures"in n){const o=e.createQuery();o.objectIds=[t.attributes[e.objectIdField]],o.returnGeometry=!0;const a=await n.queryFeatures(o);s=r(a,"features",0,"geometry")}}if(o(s))return null;if(u="point"===s.type?new N({xmin:s.x,ymin:s.y,xmax:s.x,ymax:s.y,spatialReference:s.spatialReference}):s.extent,!u)return null;M()||V(u.spatialReference,i)||await q();const f=L(u,i);return f?c=c?c.union(f):f:null}function K(t){if(t&&(!Array.isArray(t)||"number"!=typeof t[0])&&("object"==typeof t||Array.isArray(t)&&"object"==typeof t[0])){if("layer"in t&&t.layer&&t.layer.minScale&&t.layer.maxScale){const e=t.layer;return{min:e.minScale,max:e.maxScale}}if(Array.isArray(t)&&t.length&&t.every((t=>"layer"in t))){let e=0,n=0;for(const r of t){const t=r.layer;t&&t.minScale&&t.maxScale&&(e=t.minScale<e?t.minScale:e,n=t.maxScale>n?t.maxScale:n)}return e&&n?{min:e,max:n}:null}}}function X(t,e){return E(D(t),e)?t:L(t,e)}async function Y(e,r){if(!e||!r)return new t({targetGeometry:new I,scale:0,rotation:0});let o=r.spatialReference;const{constraints:a,padding:i,viewpoint:c,size:s}=r,u=[i?s[0]-i.left-i.right:s[0],i?s[1]-i.top-i.bottom:s[1]];let f=null;e instanceof t?f=e:e.viewpoint?f=e.viewpoint:e.target&&"esri.Viewpoint"===e.target.declaredClass&&(f=e.target);let l=null;f&&f.targetGeometry?l=f.targetGeometry:e instanceof N?l=e:(e||e&&("center"in e||"extent"in e||"target"in e))&&(l=await J(e.center,r,o)||await J(e.extent,r,o)||await J(e.target,r,o)||await J(e,r,o)),!l&&c&&c.targetGeometry?l=c.targetGeometry:!l&&r.extent&&(l=r.extent),o||(o=D(r.spatialReference||r.extent||l)),M()||E(l.spatialReference,o)||V(l,o)||await q();const m=X(l.center?l.center:l,o);let y=null;if(f&&n(f.targetGeometry)&&"point"===f.targetGeometry.type)y=f.scale;else if("scale"in e&&e.scale)y=e.scale;else if("zoom"in e&&-1!==e.zoom&&a&&a.effectiveLODs)y=a.zoomToScale(e.zoom);else if(Array.isArray(l)||"point"===l.type||"extent"===l.type&&0===l.width&&0===l.height){const t=X(r.extent,o);y=n(t)?H(t,u):r.extent?H(r.extent,u):c.scale}else y=H(X(l.extent,o),u);const p=K(e);p&&(p.min&&p.min>y?y=p.min:p.max&&p.max<y&&(y=p.max));let g=0;f?g=f.rotation:e.hasOwnProperty("rotation")?g=e.rotation:c&&(g=c.rotation);let x=new t({targetGeometry:m,scale:y,rotation:g});return a&&(x=a.fit(x),a.constrainByGeometry(x),a.rotationEnabled||(x.rotation=g)),x}function Z(t,e){const n=t.targetGeometry,r=e.targetGeometry;return n.x=r.x,n.y=r.y,n.spatialReference=r.spatialReference,t.scale=e.scale,t.rotation=e.rotation,t}function $(t,e,n){return n?x(t,.5*(e[0]-n.right+n.left),.5*(e[1]-n.bottom+n.top)):g(t,e,.5)}const _=function(){const t=F();return function(e,n,r){const o=n.targetGeometry;T(t,o);const a=.5*ot(n);return e.xmin=t[0]-a*r[0],e.ymin=t[1]-a*r[1],e.xmax=t[0]+a*r[0],e.ymax=t[1]+a*r[1],e.spatialReference=o.spatialReference,e}}();function tt(t,e,n,r,o){return xt(t,e,n.center),t.scale=H(n,r),o&&o.constraints&&o.constraints.constrain(t),t}function et(t,e,n,r){return ft(t,e,n,r),m(t,t)}const nt=function(){const t=F();return function(e,n,r){return b(e,st(e,n),$(t,n,r))}}(),rt=function(){const t=p(),e=F();return function(n,r,o,a){const i=ot(r),f=it(r);return x(e,i,i),c(t,e),s(t,t,f),u(t,t,nt(e,o,a)),u(t,t,[0,a.top-a.bottom]),x(n,t[4],t[5])}}();function ot(t){return t.scale*at(t.targetGeometry)}function at(t){return n(t)&&C(t.spatialReference)?1/(W(t.spatialReference)*U*Q):1}function it(t){return i(t.rotation)||0}function ct(t){return C(t)?W(t)*U*Q:1}function st(t,e){return g(t,e,.5)}const ut=function(){const t=F(),e=F(),n=F();return function(r,o,a,i,c,m){return w(t,o),g(e,a,.5*m),x(n,1/i*m,-1/i*m),f(r,e),c&&s(r,r,c),l(r,r,n),u(r,r,t),r}}(),ft=function(){const t=F();return function(e,n,r,o){const a=ot(n),i=it(n);return T(t,n.targetGeometry),ut(e,t,r,a,i,o)}}(),lt=function(){const t=F();return function(e,n,r,o){const a=ot(n);return T(t,n.targetGeometry),ut(e,t,r,a,0,o)}}();function mt(t){const e=O(t);return e?e.valid[1]-e.valid[0]:0}function yt(t,e){return Math.round(mt(t)/e)}const pt=function(){const t=F(),e=F(),n=[0,0,0];return function(r,o,a){d(t,r,o),j(t,t),d(e,r,a),j(e,e),G(n,t,e);let i=Math.acos(R(t,e)/(k(t)*k(e)))*B;return n[2]<0&&(i=-i),isNaN(i)&&(i=0),i}}(),gt=function(){const t=F();return function(e,n,r,o){const a=e.targetGeometry;return Z(e,n),rt(t,n,r,o),a.x+=t[0],a.y+=t[1],e}}(),xt=function(t,e,n){Z(t,e);const r=t.targetGeometry;return r.x=n.x,r.y=n.y,r.spatialReference=n.spatialReference,t},ht=function(){const t=F();return function(e,n,r,o,a){a||(a="center"),b(t,r,o),g(t,t,.5);const i=t[0],c=t[1];switch(a){case"center":x(t,0,0);break;case"left":x(t,-i,0);break;case"top":x(t,0,c);break;case"right":x(t,i,0);break;case"bottom":x(t,0,-c);break;case"top-left":x(t,-i,c);break;case"bottom-left":x(t,-i,-c);break;case"top-right":x(t,i,c);break;case"bottom-right":x(t,i,-c)}return St(e,n,t),e}}();function bt(t,e,n){return Z(t,e),t.rotation+=n,t}function wt(t,e,n){return Z(t,e),t.rotation=n,t}const dt=function(){const t=F();return function(e,n,r,o,a){return Z(e,n),isNaN(r)||0===r||(kt(t,o,n,a),e.scale=n.scale*r,At(t,t,e,a),St(e,e,x(t,t[0]-o[0],o[1]-t[1]))),e}}();function jt(t,e,n){return Z(t,e),t.scale=n,t}const Gt=function(){const t=F();return function(e,n,r,o,a,i){return Z(e,n),isNaN(r)||0===r||(kt(t,a,n,i),e.scale=n.scale*r,e.rotation+=o,At(t,t,e,i),St(e,e,x(t,t[0]-a[0],a[1]-t[1]))),e}}(),Rt=function(){const t=F(),e=F();return function(n,r,o,a,i,c,s){return nt(e,c,s),S(t,i,e),a?Gt(n,r,o,a,t,c):dt(n,r,o,t,c)}}(),kt=function(){const t=p();return function(e,n,r,o){return A(e,n,et(t,r,o,1))}}(),At=function(){const t=p();return function(e,n,r,o){return A(e,n,ft(t,r,o,1))}}(),St=function(){const t=F(),e=p();return function(n,r,o){Z(n,r);const a=ot(r),i=n.targetGeometry;return y(e,it(r)),l(e,e,v(a,a)),A(t,o,e),i.x+=t[0],i.y+=t[1],n}}();export{gt as addPadding,pt as angleBetween,xt as centerAt,Z as copy,Y as create,H as extentToScale,$ as getAnchor,_ as getExtent,ut as getMatrix,rt as getPaddingMapTranslation,nt as getPaddingScreenTranslation,ot as getResolution,ct as getResolutionToScaleFactor,ft as getTransform,lt as getTransformNoRotation,yt as getWorldScreenWidth,mt as getWorldWidth,Rt as padAndScaleAndRotateBy,ht as resize,bt as rotateBy,wt as rotateTo,Gt as scaleAndRotateBy,jt as scaleTo,tt as setExtent,kt as toMap,At as toScreen,St as translateBy};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../../chunks/tslib.es6.js";import{isSome as
|
|
5
|
+
import{_ as r}from"../../../chunks/tslib.es6.js";import{isSome as e}from"../../../core/maybe.js";import{EsriPromiseMixin as t}from"../../../core/Promise.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";const i=i=>{let p=class extends(t(i)){constructor(){super(...arguments),this.parent=null}get updating(){return!1}get visible(){return!e(this.parent)||this.parent.visible&&!this.parent.suspended}set visible(r){void 0!==r?this._override("visible",r):this._clearOverride("visible")}};return r([o({readOnly:!0})],p.prototype,"type",void 0),r([o({constructOnly:!0})],p.prototype,"analysis",void 0),r([o({constructOnly:!0})],p.prototype,"parent",void 0),r([o({constructOnly:!0})],p.prototype,"view",void 0),r([o()],p.prototype,"interactive",void 0),r([o({readOnly:!0})],p.prototype,"updating",null),r([o()],p.prototype,"visible",null),p=r([s("esri.views.3d.analysis.AnalysisView3D")],p),p};export{i as AnalysisView3D};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{destroyHandle as t}from"../../../../core/handleUtils.js";import{isSome as i,isNone as o}from"../../../../core/maybe.js";import{watch as s,syncAndInitial as n}from"../../../../core/reactiveUtils.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 a}from"../../../../core/accessorSupport/decorators/subclass.js";import{sv3d as c}from"../../../../geometry/support/vectorStacks.js";import{LengthDimensionSubTool as l}from"./LengthDimensionSubTool.js";import{newIntersector as m}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as h}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{InteractiveToolBase as p}from"../../../interactive/InteractiveToolBase.js";import{createScreenPointArrayFromEvent as u}from"../../../support/screenUtils.js";var d;!function(e){e.Ready="ready",e.Creating="creating",e.Created="created"}(d||(d={}));let v=class extends p{constructor(){super(...arguments),this.preferManipulatorCursor=!0,this.analysisView=null}initialize(){this._intersector=m(this.view.state.viewingMode),this._intersector.options.store=h.MIN,this._lengthDimensionSubTool=new l({view:this.view}),this.own(t(this._lengthDimensionSubTool));for(const e of this.analysis.dimensions.items)this._addDimension(e);this.own(this.analysis.dimensions.on("change",(e=>{for(const t of e.added)this._addDimension(t);for(const t of e.removed)this._removeDimension(t)}))),this.own(s((()=>this.state),(e=>{e===d.Created&&this.finishToolCreation()}),n))}get state(){return this.analysis.dimensions.some((e=>"length"===e.type))?this.active?d.Creating:d.Created:d.Ready}get cursor(){return this.active?"crosshair":null}getManipulatorsForDimension(e){return this._lengthDimensionSubTool.getManipulatorsForDimension(e)}onInputEvent(e){switch(e.type){case"immediate-click":this._clickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onActivate(){this._activeSubTool=this._lengthDimensionSubTool}onDeactivate(){i(this._activeSubTool)&&i(this._activeSubTool.stagedDimension)&&(this.analysis.dimensions.remove(this._activeSubTool.stagedDimension),this._activeSubTool.stagedDimension=null),this._activeSubTool=null}_clickHandler(e){if(o(this._activeSubTool))return;const t=this._intersectScreen(e);if(!o(t)){if(o(this._activeSubTool.stagedDimension)){const e=this._activeSubTool.stageNewDimension(t);this.analysis.dimensions.add(e)}else this._activeSubTool.onStagedClick(t);e.stopPropagation()}}_pointerMoveHandler(e){if(o(this._activeSubTool))return;const t=this._intersectScreen(e);o(t)||this._activeSubTool.onPointerMove(t)}_intersectScreen(e){const t=u(e);this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector);const i=this._intersector.results.min,o=c.get();return i.getIntersectionPoint(o)?this.view.renderCoordsHelper.fromRenderCoords(o,this.view.spatialReference):null}_addDimension(e){this._lengthDimensionSubTool.addDimension(e,this.manipulators)}_removeDimension(e){this._lengthDimensionSubTool.removeDimension(e,this.manipulators)}};e([r({constructOnly:!0})],v.prototype,"view",void 0),e([r({constructOnly:!0})],v.prototype,"analysis",void 0),e([r({readOnly:!0})],v.prototype,"state",null),e([r({readOnly:!0})],v.prototype,"cursor",null),e([r({readOnly:!0})],v.prototype,"preferManipulatorCursor",void 0),e([r({constructOnly:!0})],v.prototype,"analysisView",void 0),e([r()],v.prototype,"_activeSubTool",void 0),e([r()],v.prototype,"_lengthDimensionSubTool",void 0),v=e([a("esri.views.3d.analysis.Dimensioning.DimensioningTool")],v);export{v as DimensioningTool};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as i}from"../../../../chunks/tslib.es6.js";import s from"../../../../core/Accessor.js";import{isNone as o}from"../../../../core/maybe.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{
|
|
5
|
+
import{_ as i}from"../../../../chunks/tslib.es6.js";import s from"../../../../core/Accessor.js";import{isNone as o}from"../../../../core/maybe.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{LengthDimensionVisualization as t}from"./LengthDimensionVisualization.js";let r=class extends s{constructor(i){super(i),this._dimensionVisualizations=new Map}initialize(){for(const i of this.analysis.dimensions.items)this._addDimension(i);this.own(this.analysis.dimensions.on("change",(i=>{i.added.forEach((i=>{this._addDimension(i)})),i.removed.forEach((i=>{this._removeDimension(i)}))})))}destroy(){this._dimensionVisualizations.forEach((i=>{i.destroy()})),this._dimensionVisualizations.clear()}get testInfo(){return{visualizations:Array.from(this._dimensionVisualizations.values())}}_addDimension(i){this._dimensionVisualizations.has(i)||this._dimensionVisualizations.set(i,new t({dimension:i,view:this.view}))}_removeDimension(i){const s=this._dimensionVisualizations.get(i);o(s)||(s.destroy(),this._dimensionVisualizations.delete(i))}};i([e({constructOnly:!0,nonNullable:!0})],r.prototype,"view",void 0),i([e({constructOnly:!0,nonNullable:!0})],r.prototype,"analysis",void 0),r=i([n("esri.views.3d.analysis.Dimensioning.DimensioningVisualization")],r);export{r as DimensioningVisualization};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../Color.js";import"../../../../geometry.js";import n from"../../../../analysis/LengthDimension.js";import o from"../../../../core/Accessor.js";import e from"../../../../core/Handles.js";import{equalsShallow as s}from"../../../../core/lang.js";import{isNone as a,isSome as r}from"../../../../core/maybe.js";import{watch as l}from"../../../../core/reactiveUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{clonePoint as d}from"../../../../layers/graphics/hydratedFeatures.js";import{settings as c}from"./settings.js";import{createSphereManipulator as u}from"../../interactive/manipulatorUtils.js";import{screenToMap3D as h,hideManipulatorWhileDragging as g}from"../../interactive/editingTools/dragEventPipeline3D.js";import{createManipulatorDragEventPipeline as v,resetProperties as M}from"../../../interactive/dragEventPipeline.js";import D from"../../../../geometry/Point.js";let P=class extends o{constructor(i){super(i),this.stagedDimension=null,this._dimensionManipulators=new Map,this._dimensionHandles=new e}initialize(){this.own(this._dimensionHandles)}addDimension(i,t){if(this._dimensionManipulators.has(i))return;const n=this._createPointManipulator(i,{isStart:!0}),o=this._createPointManipulator(i,{isStart:!1}),e={startManipulator:n,endManipulator:o};this._setupDimensionToManipulatorsSync(i,e),this._dimensionManipulators.set(i,e),t.add(n),t.add(o)}removeDimension(i,t){const n=this._dimensionManipulators.get(i);if(a(n))return;this._dimensionHandles.remove(i);const{startManipulator:o,endManipulator:e}=n;this._dimensionManipulators.delete(i),t.remove(o),t.remove(e)}getManipulatorsForDimension(i){return this._dimensionManipulators.get(i)}stageNewDimension(i){const t=new n({startPoint:i.clone(),endPoint:null});return this.stagedDimension=t,t}onStagedClick(i){a(this.stagedDimension)||(this.stagedDimension.endPoint=i.clone(),this.stagedDimension=null,this.view.activeTool=null)}onPointerMove(i){r(this.stagedDimension)&&(this.stagedDimension.endPoint=i.clone())}_setupDimensionToManipulatorsSync(i,t){const{startManipulator:n,endManipulator:o}=t;this._dimensionHandles.add([l((()=>({startPoint:i.startPoint,endPoint:i.endPoint,stagedDimension:this.stagedDimension})),(({startPoint:t,endPoint:e,stagedDimension:s})=>{r(t)?(n.available=a(s)||s===i,n.location=t):n.available=!1,r(e)?(o.available=a(s),o.location=e):o.available=!1}),{sync:!0,initial:!0,equals:s})],i)}_createPointManipulator(i,n){const{isStart:o}=n,e=o?"startPoint":"endPoint",s=u(this.view,t.toUnitRGB(c.pointManipulators.color),c.pointManipulators.opacity);s.available=!1,s.radius=c.pointManipulators.radius;const a=v(s,((t,n,o)=>{const s=g(t);n.next(s).next(h(this.view)).next((t=>{const n=d(t.mapEnd,new D);i[e]=n})),o.next(s).next(M(i,[e]))}));return this._dimensionHandles.add(a,i),s}};i([m({constructOnly:!0,nonNullable:!0})],P.prototype,"view",void 0),i([m()],P.prototype,"stagedDimension",void 0),P=i([p("esri.views.3d.analysis.Dimensioning.LengthDimensionSubTool")],P);export{P as LengthDimensionSubTool};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{destroyHandle as n}from"../../../../core/handleUtils.js";import{isNone as s}from"../../../../core/maybe.js";import{watch as i,initial as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{destroyHandle as n}from"../../../../core/handleUtils.js";import{isNone as s}from"../../../../core/maybe.js";import{watch as i,initial as o}from"../../../../core/reactiveUtils.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 m}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as a,F as l,c as d}from"../../../../chunks/vec3.js";import{f as c}from"../../../../chunks/vec4f64.js";import{sv3d as p}from"../../../../geometry/support/vectorStacks.js";import{LineVisualElement as u}from"../../interactive/visualElements/LineVisualElement.js";import{EuclideanSegment as h}from"../../interactive/visualElements/support/Segment.js";import{RenderOccludedFlag as S}from"../../webgl-engine/lib/Material.js";import{createStipplePatternSimple as _}from"../../webgl-engine/materials/lineStippleUtils.js";let E=class extends t{constructor(e){super(e),this._directSegment=new h,this._dimensionSegment=new h,this._startExtensionSegment=new h(this._directSegment.startRenderSpace,this._dimensionSegment.startRenderSpace),this._endExtensionSegment=new h(this._directSegment.endRenderSpace,this._dimensionSegment.endRenderSpace);const t={view:e.view,attached:!0,width:1,color:c(1,.5,0,1),renderOccluded:S.OccludeAndTransparent},n={...t,stipplePattern:_(5)};this._dimensionVisualElement=new u(t),this._startExtensionVisualElement=new u(n),this._endExtensionVisualElement=new u(n)}initialize(){this.own([n(this._dimensionVisualElement),n(this._startExtensionVisualElement),n(this._endExtensionVisualElement)]);const e=this.dimension;this.own(i((()=>({startPoint:e.startPoint,endPoint:e.endPoint,offset:e.offset})),(e=>{this._update(e)}),o))}get testInfo(){return{dimensionVisualElement:this._dimensionVisualElement}}_update(e){const{startPoint:t,endPoint:n,offset:i}=e,{renderCoordsHelper:o}=this.view;if(s(t)||s(n)||!o.toRenderCoords(t,this._directSegment.startRenderSpace)||!o.toRenderCoords(n,this._directSegment.endRenderSpace))return this._dimensionVisualElement.visible=!1,this._startExtensionVisualElement.visible=!1,void(this._endExtensionVisualElement.visible=!1);const{startRenderSpace:r,endRenderSpace:m}=this._directSegment,a=this._directSegment.eval(.5,p.get()),l=o.worldUpAtPosition(a,p.get()),d=i/o.unitInMeters,[c,u]=g(r,m,l,d);f(this._startExtensionSegment,l,c,this._startExtensionVisualElement),f(this._endExtensionSegment,l,u,this._endExtensionVisualElement),this._dimensionVisualElement.visible=!0,this._dimensionVisualElement.setGeometryFromSegment(this._dimensionSegment)}};function g(e,t,n,s=0){const i=a(t,n),o=a(e,n),r=a(n,n),m=Math.abs(i-o)/r+s;return i>o?[m,s]:[s,m]}function f(e,t,n,s){0!==n?(l(e.endRenderSpace,e.startRenderSpace,t,n),s.visible=!0,s.setGeometryFromSegment(e)):(d(e.endRenderSpace,e.startRenderSpace),s.visible=!1)}e([r({constructOnly:!0,nonNullable:!0})],E.prototype,"dimension",void 0),e([r({constructOnly:!0,nonNullable:!0})],E.prototype,"view",void 0),E=e([m("esri.views.3d.analysis.Dimensioning.LengthDimensionVisualization")],E);export{E as LengthDimensionVisualization};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import o from"../../../../Color.js";const s={main:new o([255,127,0])};class t{constructor(){this.color=s.main,this.opacity=.5,this.radius=5}}class i{constructor(){this.pointManipulators=new t}}const n=new i;export{n as settings};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Color.js";import i from"../../../../analysis/LineOfSightAnalysisObserver.js";import r from"../../../../analysis/LineOfSightAnalysisTarget.js";import a from"../../../../core/Collection.js";import s from"../../../../core/Handles.js";import{handlesGroup as n,makeHandle as o}from"../../../../core/handleUtils.js";import l from"../../../../core/Logger.js";import{destroyMaybe as c,isSome as u,removeMaybe as h,isNone as p,applySome as d}from"../../../../core/maybe.js";import{watch as g,syncAndInitial as _,sync as m}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 y}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as b,fromPoints as f}from"../../../../geometry/support/lineSegment.js";import{getGraphicEffectiveElevationInfo as T,getConvertedElevation as M}from"../../../../support/elevationInfoUtils.js";import w from"../../../../symbols/support/ElevationInfo.js";import{LineOfSightRayIntersector as C}from"./LineOfSightRayIntersector.js";import{LineOfSightToolConfiguration as L}from"./LineOfSightToolConfiguration.js";import{createSphereManipulator as k,createSphereManipulatorRenderObjects as S}from"./lineOfSightToolUtils.js";import{LaserlineVisualElement as V}from"../../interactive/visualElements/LaserlineVisualElement.js";import{IntersectorType as O}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{createManipulatorDragEventPipeline as E}from"../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as I}from"../../../interactive/InteractiveToolBase.js";import{ManipulatorStateCustomFlags as j}from"../../../interactive/interfaces.js";var F;!function(e){e.Ready="ready",e.Creating="creating",e.Created="created"}(F||(F={}));const P=a.ofType(r),x=l.getLogger("esri.views.3d.interactive.analysisTools.lineOfSight.LineOfSightTool");let R=class extends I{constructor(e){super(e),this.configuration=new L,this.analysisView=null,this._someManipulatorsFocused=!1,this._laserlineVisualElement=null,this._grabbedManipulator=null,this._analysisHandles=new s,this._handles=new s,this._manipulatorHandles=new s,this._targetTrackerManipulator=null}initialize(){this._intersector=new C({view:this.view}),this._handles.add(g((()=>this.state),(e=>{e===F.Created&&this.finishToolCreation()}),_)),this._observerManipulator=this._createObserverManipulator(),this._handles.add([g((()=>({...this.configuration.observer})),(()=>this._updateObserverManipulatorStyle()),m),g((()=>this.analysisView.elevationAlignedObserver),(e=>this._onObserverLocationChange(e)),_),g((()=>({...this.configuration.laserLine})),(()=>this._createVisualElements()),_),this._connectComputations()])}destroy(){this._handles=c(this._handles),this._manipulatorHandles=c(this._manipulatorHandles),this._analysisHandles=c(this._analysisHandles),this._observerManipulator=null,this._clearTargetTracker(),this._removeVisualElements(),this._intersector=null,this._set("analysis",null)}get state(){return this.active?u(this._grabbedManipulator)?F.Created:F.Creating:u(this.analysis.observer)&&u(this.analysis.observer.position)?F.Created:F.Ready}get cursor(){return!this._someManipulatorsFocused&&this.active&&this._showTracker?"crosshair":null}get updating(){return!!u(this.analysisView)&&this.analysisView.updating}get _showTracker(){return this.active&&"mouse"===this._latestPointerMovePointerType}get _shouldRenderTracker(){return this._showTracker&&u(this.analysis.observer)&&u(this.analysis.observer.position)&&!this._someManipulatorsFocused}continue(){this.view.activeTool=this}stop(){this.view.activeTool=null}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"key-down":this._keyDownHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onInputEventAfter(e){if("immediate-click"===e.type)this._clickHandler(e)}onShow(){}onHide(){}onActivate(){this._manipulatorFocusChanged()}onDeactivate(){this._clearTargetTracker(),this._manipulatorFocusChanged()}_connectComputations(){let e=null;return n([g((()=>this.analysisView.computations),(t=>{e=h(e),e=t.on("change",(e=>this._onComputationsCollectionChange(e))),t.forEach((e=>this._connectComputation(e)))}),_),o((()=>e=h(e)))])}_onComputationsCollectionChange(e){e.added.forEach((e=>this._connectComputation(e))),e.removed.forEach((e=>this._disconnectComputation(e)))}_connectComputation(e){if(this.destroyed)return void x.warn("Attempting to connect an analysis to a destroyed LineOfSight tool. Ignoring.");const t=this._analysisHandles;if(t.has(e))return;const i=this._createTargetManipulator(e.target);p(this._targetTrackerManipulator)&&i.metadata.target===this.analysisView.cursorTarget&&(this._targetTrackerManipulator=i,this._targetTrackerManipulator.available=!1,this._targetTrackerManipulator.interactive=!1,this._updateLaserLineRenderer()),t.add([g((()=>this._getLineOfSightManipulatorStateDependencies(e)),(()=>this._updateManipulatorState(i,e)),_),g((()=>e.elevationAlignedTargetLocation),(e=>this._onTargetLocationChange(e,i)),_)],e)}_disconnectComputation(e){if(this.destroyed)return void x.warn("Attempting to disconnect an analysis from a destroyed LineOfSight tool. Ignoring.");this._analysisHandles.remove(e);const t=this._getTargetManipulator(e.target);u(t)&&(this.manipulators.remove(t),this._manipulatorHandles.remove(t),u(this._targetTrackerManipulator)&&this._targetTrackerManipulator===t&&(this._targetTrackerManipulator=null))}_clearTargetTracker(){u(this.analysisView.cursorTarget)&&(this.analysisView.cursorTarget=c(this.analysisView.cursorTarget))}_createManipulator(e,t,i){const r=k(this.view,e);return r.metadata=i,this._manipulatorHandles.add([t(r),r.events.on("focus-changed",(()=>this._manipulatorFocusChanged())),r.events.on("grab-changed",(e=>this._manipulatorGrabChanged(r,e))),r.events.on("immediate-click",(e=>e.stopPropagation()))],r),this.manipulators.add(r),r}_createTargetManipulator(e){const t=this.configuration,i={size:t.target.size,customColor1:t.target.visibleColor,customColor2:t.target.occludedColor,customColor3:t.target.undefinedColor,visible:!0},r={target:e,type:"target"},a=this._createManipulator(i,(e=>this._createTargetManipulatorDragPipeline(e)),r);return u(e.position)?a.elevationAlignedLocation=e.position:a.available=!1,a}_getTargetManipulator(e){let t=null;return this.manipulators.forEach((i=>{const r=i.manipulator;p(t)&&"target"===r.metadata.type&&r.metadata.target===e&&(t=r)})),t}_createObserverManipulator(){const e=this.configuration,t={size:e.observer.size,color:e.observer.color,visible:!0};return this._createManipulator(t,(e=>this._createObserverManipulatorDragPipeline(e)),{type:"observer",intersection:null})}_updateObserverManipulatorStyle(){const e=this._observerManipulator,t=this.configuration.observer,i={size:t.size,color:t.color,visible:e.available};e.renderObjects=S(i)}_manipulatorFocusChanged(){this._someManipulatorsFocused=this.manipulators.some((e=>e.manipulator.focused)),this._updateLaserLineRenderer()}_screenToIntersection(){return e=>{const t=this._intersector.getScreenPointIntersection(e.screenEnd);return p(t)?null:{...e,intersection:t}}}_createTargetManipulatorDragPipeline(e){return E(e,((t,i,r)=>{i.next(this._screenToIntersection()).next(this._updateTargetDragStep(e)).next((()=>this._updateLaserLineRenderer())),r.next(this._cancelTargetDragStep(e.metadata.target)).next((()=>this._updateLaserLineRenderer()))}))}_createObserverManipulatorDragPipeline(e){return E(e,((e,t,i)=>{t.next(this._screenToIntersection()).next(this._updateObserverDragStep()).next((()=>this._updateLaserLineRenderer())),i.next(this._cancelObserverDragStep()).next((()=>this._updateLaserLineRenderer()))}))}_updateObserverDragStep(){return e=>(u(e.intersection.point)?(p(this.analysis.observer)&&(this.analysis.observer=new i),this._updateFromIntersection(this.analysis.observer,e.intersection)):this.analysis.observer=null,e)}_cancelObserverDragStep(){const e=u(this.analysis.observer)&&u(this.analysis.observer.position)?this.analysis.observer.clone():null;return t=>(this.analysis.observer=e,t)}_updateTargetDragStep(e){return t=>{this._updateFromIntersection(e.metadata.target,t.intersection);const i=t.intersection.point;return u(i)&&(e.elevationAlignedLocation=i),t}}_cancelTargetDragStep(e){const t=d(e.position,(e=>e.clone()));return i=>(e.position=t,i)}_manipulatorGrabChanged(e,t){switch(t.action){case"start":this._grabbedManipulator=e;break;case"end":this._grabbedManipulator===e&&(this._grabbedManipulator=null)}this._manipulatorFocusChanged()}_updateManipulatorState(e,t){const{isValid:i,isTargetVisible:r}=t.computationResult;e.state=i?r?j.Custom1:j.Custom2:j.Custom3}_getLineOfSightManipulatorStateDependencies(e){const{isValid:t,isTargetVisible:i}=e.computationResult;return{isValid:t,isTargetVisible:i}}_updateLaserLineRenderer(){if(p(this._laserlineVisualElement))return;const e=this._laserlineVisualElement,t=u(this._grabbedManipulator)?this._grabbedManipulator:this._shouldRenderTracker&&u(this.analysis.observer)&&u(this.analysis.observer.position)?this._targetTrackerManipulator:null;this.configuration.laserLine.enabled&&u(t)?(e.visible=!0,e.heightManifoldTarget=t.renderLocation,t!==this._observerManipulator?e.lineVerticalPlaneSegment=f(this._observerManipulator.renderLocation,t.renderLocation,H):e.lineVerticalPlaneSegment=null):(e.visible=!1,e.heightManifoldTarget=null,e.lineVerticalPlaneSegment=null)}_createVisualElements(){const e=this.configuration.laserLine;this._removeVisualElements(),this._laserlineVisualElement=new V({view:this.view,attached:!0,style:{glowColor:t.toUnitRGB(e.glowColor),glowWidth:e.glowWidth,innerColor:t.toUnitRGB(e.innerColor),innerWidth:e.innerWidth,globalAlpha:e.globalAlpha}})}_removeVisualElements(){u(this._laserlineVisualElement)&&(this._laserlineVisualElement.destroy(),this._laserlineVisualElement=null)}_onObserverLocationChange(e){p(e)?this._observerManipulator.available=!1:(this._observerManipulator.metadata.intersection=null,this._observerManipulator.available=!0,this._observerManipulator.elevationAlignedLocation=e)}_onTargetLocationChange(e,t){u(e)?(t.elevationAlignedLocation=e,t!==this._targetTrackerManipulator&&(t.available=!0)):t.available=!1}_addPointFromClickEvent(e){const t=this._intersector.getScreenPointIntersection(e);if(!p(t)&&!p(t.point))if(u(this.analysis.observer)&&u(this.analysis.observer.position)){this._clearTargetTracker();const e=new r;this._updateFromIntersection(e,t),this.analysis.targets.add(e)}else{const e=new i;this._updateFromIntersection(e,t),this.analysis.observer=e}}_clickHandler(e){this.active&&(this._addPointFromClickEvent({x:e.x,y:e.y}),e.stopPropagation())}_doubleClickHandler(e){this.active&&(this.stop(),e.stopPropagation())}_keyDownHandler(e){this.active&&"Escape"===e.key&&(this.stop(),e.stopPropagation())}_pointerMoveHandler(e){if(this._latestPointerMovePointerType=e.pointerType,this._updateLaserLineRenderer(),!this._showTracker||p(this.analysis.observer)||p(this.analysis.observer.position))return;const t={x:e.x,y:e.y},i=this._intersector.getScreenPointIntersection(t);u(i)&&u(i.point)&&(p(this.analysisView.cursorTarget)&&(this.analysisView.cursorTarget=new r),this._updateFromIntersection(this.analysisView.cursorTarget,i),this._updateLaserLineRenderer())}_updateFromIntersection(e,t){if(p(t.point))return e.position=null,e.elevationInfo=null,void(e.excludedFeature=null);switch(t.type){case O.OBJECT:if(u(t.graphic)){const i=t.graphic,r=T(i);"on-the-ground"===r.mode&&(r.mode="relative-to-ground",r.offset=0),e.elevationInfo=new w(r),e.excludedFeature=i}else e.elevationInfo=null,e.excludedFeature=null;break;case O.TERRAIN:case O.I3S:e.elevationInfo=new w({mode:"on-the-ground"}),e.excludedFeature=null;break;default:e.elevationInfo=null,e.excludedFeature=null}const i=t.point.clone();i.z=M(this.view,i,{mode:"absolute-height",offset:0},e.elevationInfo),e.position=i}get testInfo(){return{laserLineVisualElement:this._laserlineVisualElement}}};e([v({constructOnly:!0})],R.prototype,"view",void 0),e([v({constructOnly:!0})],R.prototype,"analysis",void 0),e([v({readOnly:!0})],R.prototype,"state",null),e([v({readOnly:!0})],R.prototype,"cursor",null),e([v({readOnly:!0})],R.prototype,"updating",null),e([v({type:L})],R.prototype,"configuration",void 0),e([v({constructOnly:!0})],R.prototype,"analysisView",void 0),e([v({readOnly:!0})],R.prototype,"_showTracker",null),e([v()],R.prototype,"_latestPointerMovePointerType",void 0),e([v()],R.prototype,"_shouldRenderTracker",null),e([v()],R.prototype,"_someManipulatorsFocused",void 0),e([v()],R.prototype,"_laserlineVisualElement",void 0),e([v()],R.prototype,"_grabbedManipulator",void 0),R=e([y("esri.views.3d.interactive.analysisTools.lineOfSight.LineOfSightTool")],R);const H=b();export{P as LineOfSightTargetCollection,R as LineOfSightTool};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Color.js";import i from"../../../../analysis/LineOfSightAnalysisObserver.js";import r from"../../../../analysis/LineOfSightAnalysisTarget.js";import a from"../../../../core/Collection.js";import s from"../../../../core/Handles.js";import{handlesGroup as n,makeHandle as o}from"../../../../core/handleUtils.js";import l from"../../../../core/Logger.js";import{destroyMaybe as c,isSome as u,removeMaybe as h,isNone as p,applySome as d}from"../../../../core/maybe.js";import{watch as g,syncAndInitial as _,sync as m}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 y}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as b,fromPoints as f}from"../../../../geometry/support/lineSegment.js";import{getGraphicEffectiveElevationInfo as T,getConvertedElevation as M}from"../../../../support/elevationInfoUtils.js";import w from"../../../../symbols/support/ElevationInfo.js";import{LineOfSightRayIntersector as C}from"./LineOfSightRayIntersector.js";import{LineOfSightToolConfiguration as L}from"./LineOfSightToolConfiguration.js";import{createSphereManipulator as k,createSphereManipulatorRenderObjects as S}from"./lineOfSightToolUtils.js";import{LaserlineVisualElement as V}from"../../interactive/visualElements/LaserlineVisualElement.js";import{IntersectorType as O}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{createManipulatorDragEventPipeline as E}from"../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as I}from"../../../interactive/InteractiveToolBase.js";import{ManipulatorStateCustomFlags as j}from"../../../interactive/interfaces.js";import{createScreenPointFromEvent as P}from"../../../support/screenUtils.js";var F;!function(e){e.Ready="ready",e.Creating="creating",e.Created="created"}(F||(F={}));const R=a.ofType(r),H=l.getLogger("esri.views.3d.interactive.analysisTools.lineOfSight.LineOfSightTool");let x=class extends I{constructor(e){super(e),this.preferManipulatorCursor=!0,this.configuration=new L,this.analysisView=null,this._someManipulatorsFocused=!1,this._laserlineVisualElement=null,this._grabbedManipulator=null,this._analysisHandles=new s,this._handles=new s,this._manipulatorHandles=new s,this._targetTrackerManipulator=null}initialize(){this._intersector=new C({view:this.view}),this._handles.add(g((()=>this.state),(e=>{e===F.Created&&this.finishToolCreation()}),_)),this._observerManipulator=this._createObserverManipulator(),this._handles.add([g((()=>({...this.configuration.observer})),(()=>this._updateObserverManipulatorStyle()),m),g((()=>this.analysisView.elevationAlignedObserver),(e=>this._onObserverLocationChange(e)),_),g((()=>({...this.configuration.laserLine})),(()=>this._createVisualElements()),_),this._connectComputations()])}destroy(){this._handles=c(this._handles),this._manipulatorHandles=c(this._manipulatorHandles),this._analysisHandles=c(this._analysisHandles),this._observerManipulator=null,this._clearTargetTracker(),this._removeVisualElements(),this._intersector=null,this._set("analysis",null)}get state(){return this.active?u(this._grabbedManipulator)?F.Created:F.Creating:u(this.analysis.observer)&&u(this.analysis.observer.position)?F.Created:F.Ready}get cursor(){return this.active&&this._showTracker?"crosshair":null}get updating(){return!!u(this.analysisView)&&this.analysisView.updating}get _showTracker(){return this.active&&"mouse"===this._latestPointerMovePointerType}get _shouldRenderTracker(){return this._showTracker&&u(this.analysis.observer)&&u(this.analysis.observer.position)&&!this._someManipulatorsFocused}continue(){this.view.activeTool=this}stop(){this.view.activeTool=null}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"key-down":this._keyDownHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onInputEventAfter(e){if("immediate-click"===e.type)this._clickHandler(e)}onShow(){}onHide(){}onActivate(){this._manipulatorFocusChanged()}onDeactivate(){this._clearTargetTracker(),this._manipulatorFocusChanged()}_connectComputations(){let e=null;return n([g((()=>this.analysisView.computations),(t=>{e=h(e),e=t.on("change",(e=>this._onComputationsCollectionChange(e))),t.forEach((e=>this._connectComputation(e)))}),_),o((()=>e=h(e)))])}_onComputationsCollectionChange(e){e.added.forEach((e=>this._connectComputation(e))),e.removed.forEach((e=>this._disconnectComputation(e)))}_connectComputation(e){if(this.destroyed)return void H.warn("Attempting to connect an analysis to a destroyed LineOfSight tool. Ignoring.");const t=this._analysisHandles;if(t.has(e))return;const i=this._createTargetManipulator(e.target);p(this._targetTrackerManipulator)&&i.metadata.target===this.analysisView.cursorTarget&&(this._targetTrackerManipulator=i,this._targetTrackerManipulator.available=!1,this._targetTrackerManipulator.interactive=!1,this._updateLaserLineRenderer()),t.add([g((()=>this._getLineOfSightManipulatorStateDependencies(e)),(()=>this._updateManipulatorState(i,e)),_),g((()=>e.elevationAlignedTargetLocation),(e=>this._onTargetLocationChange(e,i)),_)],e)}_disconnectComputation(e){if(this.destroyed)return void H.warn("Attempting to disconnect an analysis from a destroyed LineOfSight tool. Ignoring.");this._analysisHandles.remove(e);const t=this._getTargetManipulator(e.target);u(t)&&(this.manipulators.remove(t),this._manipulatorHandles.remove(t),u(this._targetTrackerManipulator)&&this._targetTrackerManipulator===t&&(this._targetTrackerManipulator=null))}_clearTargetTracker(){u(this.analysisView.cursorTarget)&&(this.analysisView.cursorTarget=c(this.analysisView.cursorTarget))}_createManipulator(e,t,i){const r=k(this.view,e);return r.metadata=i,this._manipulatorHandles.add([t(r),r.events.on("focus-changed",(()=>this._manipulatorFocusChanged())),r.events.on("grab-changed",(e=>this._manipulatorGrabChanged(r,e))),r.events.on("immediate-click",(e=>e.stopPropagation()))],r),this.manipulators.add(r),r}_createTargetManipulator(e){const t=this.configuration,i={size:t.target.size,customColor1:t.target.visibleColor,customColor2:t.target.occludedColor,customColor3:t.target.undefinedColor,visible:!0},r={target:e,type:"target"},a=this._createManipulator(i,(e=>this._createTargetManipulatorDragPipeline(e)),r);return u(e.position)?a.elevationAlignedLocation=e.position:a.available=!1,a}_getTargetManipulator(e){let t=null;return this.manipulators.forEach((i=>{const r=i.manipulator;p(t)&&"target"===r.metadata.type&&r.metadata.target===e&&(t=r)})),t}_createObserverManipulator(){const e=this.configuration,t={size:e.observer.size,color:e.observer.color,visible:!0};return this._createManipulator(t,(e=>this._createObserverManipulatorDragPipeline(e)),{type:"observer",intersection:null})}_updateObserverManipulatorStyle(){const e=this._observerManipulator,t=this.configuration.observer,i={size:t.size,color:t.color,visible:e.available};e.renderObjects=S(i)}_manipulatorFocusChanged(){this._someManipulatorsFocused=this.manipulators.some((e=>e.manipulator.focused)),this._updateLaserLineRenderer()}_screenToIntersection(){return e=>{const t=this._intersector.getScreenPointIntersection(e.screenEnd);return p(t)?null:{...e,intersection:t}}}_createTargetManipulatorDragPipeline(e){return E(e,((t,i,r)=>{i.next(this._screenToIntersection()).next(this._updateTargetDragStep(e)).next((()=>this._updateLaserLineRenderer())),r.next(this._cancelTargetDragStep(e.metadata.target)).next((()=>this._updateLaserLineRenderer()))}))}_createObserverManipulatorDragPipeline(e){return E(e,((e,t,i)=>{t.next(this._screenToIntersection()).next(this._updateObserverDragStep()).next((()=>this._updateLaserLineRenderer())),i.next(this._cancelObserverDragStep()).next((()=>this._updateLaserLineRenderer()))}))}_updateObserverDragStep(){return e=>(u(e.intersection.point)?(p(this.analysis.observer)&&(this.analysis.observer=new i),this._updateFromIntersection(this.analysis.observer,e.intersection)):this.analysis.observer=null,e)}_cancelObserverDragStep(){const e=u(this.analysis.observer)&&u(this.analysis.observer.position)?this.analysis.observer.clone():null;return t=>(this.analysis.observer=e,t)}_updateTargetDragStep(e){return t=>{this._updateFromIntersection(e.metadata.target,t.intersection);const i=t.intersection.point;return u(i)&&(e.elevationAlignedLocation=i),t}}_cancelTargetDragStep(e){const t=d(e.position,(e=>e.clone()));return i=>(e.position=t,i)}_manipulatorGrabChanged(e,t){switch(t.action){case"start":this._grabbedManipulator=e;break;case"end":this._grabbedManipulator===e&&(this._grabbedManipulator=null)}this._manipulatorFocusChanged()}_updateManipulatorState(e,t){const{isValid:i,isTargetVisible:r}=t.computationResult;e.state=i?r?j.Custom1:j.Custom2:j.Custom3}_getLineOfSightManipulatorStateDependencies(e){const{isValid:t,isTargetVisible:i}=e.computationResult;return{isValid:t,isTargetVisible:i}}_updateLaserLineRenderer(){if(p(this._laserlineVisualElement))return;const e=this._laserlineVisualElement,t=u(this._grabbedManipulator)?this._grabbedManipulator:this._shouldRenderTracker&&u(this.analysis.observer)&&u(this.analysis.observer.position)?this._targetTrackerManipulator:null;this.configuration.laserLine.enabled&&u(t)?(e.visible=!0,e.heightManifoldTarget=t.renderLocation,t!==this._observerManipulator?e.lineVerticalPlaneSegment=f(this._observerManipulator.renderLocation,t.renderLocation,D):e.lineVerticalPlaneSegment=null):(e.visible=!1,e.heightManifoldTarget=null,e.lineVerticalPlaneSegment=null)}_createVisualElements(){const e=this.configuration.laserLine;this._removeVisualElements(),this._laserlineVisualElement=new V({view:this.view,attached:!0,style:{glowColor:t.toUnitRGB(e.glowColor),glowWidth:e.glowWidth,innerColor:t.toUnitRGB(e.innerColor),innerWidth:e.innerWidth,globalAlpha:e.globalAlpha}})}_removeVisualElements(){u(this._laserlineVisualElement)&&(this._laserlineVisualElement.destroy(),this._laserlineVisualElement=null)}_onObserverLocationChange(e){p(e)?this._observerManipulator.available=!1:(this._observerManipulator.metadata.intersection=null,this._observerManipulator.available=!0,this._observerManipulator.elevationAlignedLocation=e)}_onTargetLocationChange(e,t){u(e)?(t.elevationAlignedLocation=e,t!==this._targetTrackerManipulator&&(t.available=!0)):t.available=!1}_addPointFromClickEvent(e){const t=this._intersector.getScreenPointIntersection(e);if(!p(t)&&!p(t.point))if(u(this.analysis.observer)&&u(this.analysis.observer.position)){this._clearTargetTracker();const e=new r;this._updateFromIntersection(e,t),this.analysis.targets.add(e)}else{const e=new i;this._updateFromIntersection(e,t),this.analysis.observer=e}}_clickHandler(e){this.active&&(this._addPointFromClickEvent(P(e)),e.stopPropagation())}_doubleClickHandler(e){this.active&&(this.stop(),e.stopPropagation())}_keyDownHandler(e){this.active&&"Escape"===e.key&&(this.stop(),e.stopPropagation())}_pointerMoveHandler(e){if(this._latestPointerMovePointerType=e.pointerType,this._updateLaserLineRenderer(),!this._showTracker||p(this.analysis.observer)||p(this.analysis.observer.position))return;const t={x:e.x,y:e.y},i=this._intersector.getScreenPointIntersection(t);u(i)&&u(i.point)&&(p(this.analysisView.cursorTarget)&&(this.analysisView.cursorTarget=new r),this._updateFromIntersection(this.analysisView.cursorTarget,i),this._updateLaserLineRenderer())}_updateFromIntersection(e,t){if(p(t.point))return e.position=null,e.elevationInfo=null,void(e.excludedFeature=null);switch(t.type){case O.OBJECT:if(u(t.graphic)){const i=t.graphic,r=T(i);"on-the-ground"===r.mode&&(r.mode="relative-to-ground",r.offset=0),e.elevationInfo=new w(r),e.excludedFeature=i}else e.elevationInfo=null,e.excludedFeature=null;break;case O.TERRAIN:case O.I3S:e.elevationInfo=new w({mode:"on-the-ground"}),e.excludedFeature=null;break;default:e.elevationInfo=null,e.excludedFeature=null}const i=t.point.clone();i.z=M(this.view,i,{mode:"absolute-height",offset:0},e.elevationInfo),e.position=i}get testInfo(){return{laserLineVisualElement:this._laserlineVisualElement}}};e([v({constructOnly:!0})],x.prototype,"view",void 0),e([v({constructOnly:!0})],x.prototype,"analysis",void 0),e([v({readOnly:!0})],x.prototype,"state",null),e([v({readOnly:!0})],x.prototype,"cursor",null),e([v({readOnly:!0})],x.prototype,"preferManipulatorCursor",void 0),e([v({readOnly:!0})],x.prototype,"updating",null),e([v({type:L})],x.prototype,"configuration",void 0),e([v({constructOnly:!0})],x.prototype,"analysisView",void 0),e([v({readOnly:!0})],x.prototype,"_showTracker",null),e([v()],x.prototype,"_latestPointerMovePointerType",void 0),e([v()],x.prototype,"_shouldRenderTracker",null),e([v()],x.prototype,"_someManipulatorsFocused",void 0),e([v()],x.prototype,"_laserlineVisualElement",void 0),e([v()],x.prototype,"_grabbedManipulator",void 0),x=e([y("esri.views.3d.interactive.analysisTools.lineOfSight.LineOfSightTool")],x);const D=b();export{R as LineOfSightTargetCollection,x as LineOfSightTool};
|