@arcgis/core 4.26.0-next.20221221 → 4.26.0-next.20221223
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/WebScene.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{2163b9ee4d639d5ed6f3.js → 05bba3ba2f9ee02f52b5.js} +1 -1
- package/assets/esri/core/workers/chunks/{bbccf69f4aa1b1761265.js → 0b8dc54801a7aa5e6be3.js} +1 -1
- package/assets/esri/core/workers/chunks/{6dbd3aabfe4d5d593205.js → 0b9c53e01d6ac1e7d5ca.js} +29 -29
- package/assets/esri/core/workers/chunks/1039cd48a12e88baa97a.js +1 -0
- package/assets/esri/core/workers/chunks/{634e7957696f72c8b8b1.js → 3fb4ae8d6e8563a1c255.js} +1 -1
- package/assets/esri/core/workers/chunks/{b61ce04af4e57b1856cb.js → d447ebc944a9867f5a99.js} +1 -1
- package/assets/esri/core/workers/chunks/e3ba96417fd75a5d2feb.js +1 -0
- package/assets/esri/core/workers/chunks/{099765dff2b7e6958d3d.js → efc9030af5aac27055a1.js} +1 -1
- package/assets/esri/themes/base/widgets/_UtilityNetworkTrace.scss +1 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_nb.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_he.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_ar.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_bg.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_bs.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_ca.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_cs.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_da.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_de.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_el.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_es.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_et.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_fi.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_fr.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_he.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_hr.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_hu.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_id.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_it.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_ja.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_ko.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_lt.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_lv.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_nb.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_nl.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_pl.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_pt-BR.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_pt-PT.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_ro.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_ru.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_sk.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_sl.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_sr.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_sv.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_th.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_tr.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_uk.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_vi.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_zh-CN.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_zh-HK.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_zh-TW.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ar.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_bg.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_bs.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ca.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_cs.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_da.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_de.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_el.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_es.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_et.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_fi.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_fr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_he.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_hr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_hu.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_id.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_it.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ja.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ko.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_lt.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_lv.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_nb.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_nl.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_pl.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_pt-BR.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_pt-PT.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ro.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ru.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sk.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sl.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sv.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_th.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_tr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_uk.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_vi.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_zh-CN.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_zh-HK.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_zh-TW.json +1 -1
- package/core/workers/workers.js +1 -1
- package/geometry/support/intersects.js +1 -1
- package/geometry/support/meshUtils/elevation.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/index.js +1 -1
- package/geometry.js +1 -1
- package/interfaces.d.ts +868 -0
- package/intl.js +1 -1
- package/layers/support/ImageParameters.js +1 -1
- package/layers/support/VoxelVariable.js +1 -1
- package/layers/support/VoxelVolumeStyle.js +1 -1
- package/layers/support/domains.js +1 -1
- package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
- package/libs/maquette/projection.js +1 -1
- package/package.json +1 -1
- package/pointCloudRenderers.js +1 -1
- package/popup/content.js +1 -1
- package/rasterRenderers.js +1 -1
- package/renderers.js +1 -1
- package/rest/locator/addressesToLocations.js +1 -1
- package/support/arcadeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/unitConversionUtils.js +1 -1
- package/symbols.js +1 -1
- package/views/2d/engine/FeatureContainer.js +1 -1
- package/views/2d/layers/BaseLayerViewGL2D.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/GraphicsLayerView2D.js +1 -1
- package/views/2d/layers/KMLLayerView2D.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/MapImageLayerView2D.js +1 -1
- package/views/2d/layers/MapNotesLayerView2D.js +1 -1
- package/views/2d/layers/RouteLayerView2D.js +1 -1
- package/views/2d/layers/StreamLayerView2D.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/WMSLayerView2D.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/controllers/FeatureController2D.js +1 -1
- package/views/2d/layers/features/processors/HeatmapProcessor.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/BaseFeatureSource.js +1 -1
- package/views/2d/layers/features/sources/DataTileSource.js +1 -1
- package/views/2d/layers/features/sources/DataTileSubscription.js +1 -1
- package/views/2d/layers/features/sources/GeoEventSource.js +1 -1
- package/views/2d/layers/features/sources/SnapshotFeatureSource.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/rendererUtils.js +1 -1
- package/views/2d/layers/features/tileRenderers/SymbolTileRenderer.js +1 -1
- package/views/2d/layers/features/tileRenderers/support/HeatmapSource.js +1 -1
- package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
- package/views/2d/layers/features/tileRenderers/support/visualVariablesUtils.js +1 -1
- package/views/2d/layers/graphics/BaseGraphicContainer.js +1 -1
- package/views/2d/layers/graphics/GraphicBoundsRenderer.js +1 -1
- package/views/2d/layers/graphics/graphicsUtils.js +1 -1
- package/views/2d/layers/imagery/ImageryView2D.js +1 -1
- package/views/2d/layers/support/DebugOverlay.js +1 -1
- package/views/2d/layers/support/ExportStrategy.js +1 -1
- package/views/2d/layers/support/FeatureLayerProxy.js +1 -1
- package/views/2d/magnifier/MagnifierView2D.js +1 -1
- package/views/2d/navigation/MapViewNavigation.js +1 -1
- package/views/2d/navigation/ZoomBox.js +1 -1
- package/views/2d/navigation/actions/Pan.js +1 -1
- package/views/2d/navigation/actions/Pinch.js +1 -1
- package/views/2d/tiling/TileManager.js +1 -1
- package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsView3D.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/TiledLayerView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/WMTSLayerView3D.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/QueryEngine.js +1 -1
- package/views/3d/layers/graphics/SpatialIndex2D.js +1 -1
- package/views/3d/layers/graphics/elevationAlignmentUtils.js +1 -1
- package/views/3d/layers/graphics/featureExpressionInfoUtils.js +1 -1
- package/views/3d/layers/graphics/graphicUtils.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/graphics/queryForSymbologySnapping.js +1 -1
- package/views/3d/layers/graphics/symbolComplexity.js +1 -1
- package/views/3d/layers/graphics/wosrLoader.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/attributeEditing.js +1 -1
- package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
- package/views/3d/layers/support/FeatureTileTree3DDebugger.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/layers/support/projectExtentUtils.js +1 -1
- package/views/3d/support/PBFDecoderWorker.js +1 -1
- package/views/3d/support/SharedSymbolResources.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/support/geometry3dUtils.js +1 -1
- package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
- package/widgets/Daylight.js +1 -1
- package/widgets/Directions/components/SaveLayer.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTemplates/ItemList.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/ShadowCast/components/Label.js +1 -1
- package/widgets/Slice/SlicePlane.js +1 -1
- package/widgets/Slice.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/Weather.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/assets/esri/core/workers/chunks/7ce1b3056f392cd10031.js +0 -1
- package/assets/esri/core/workers/chunks/fc197a387187daab1df3.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Handles.js";import i from"../../../../core/Logger.js";import{someMap as r}from"../../../../core/MapUtils.js";import{isSome as a,destroyMaybe as n,isNone as o,unwrap as u}from"../../../../core/maybe.js";import{isAbortError as l,eachAlways as h,throwIfAborted as c}from"../../../../core/promiseUtils.js";import{on as d}from"../../../../core/reactiveUtils.js";import{schedule as p}from"../../../../core/scheduling.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as _,equals as g,clone as F,expand as y,toExtent as T}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as x,hasVertices as E}from"../../../../layers/graphics/dehydratedFeatures.js";import C from"../../../../rest/support/QuantizationParameters.js";import R from"../../../../rest/support/Query.js";import{ViewingMode as b}from"../../../ViewingMode.js";import{MultiFeatureReference as v,SingleFeatureReference as M}from"./featureReference.js";import{FAILED_FEATURE_COUNT as D,FetchStatus as w,FeatureTile as O}from"./FeatureTile.js";import{tilesAreRelated as j}from"../../terrain/tileUtils.js";import{ImmediateTask as P,TaskPriority as N}from"../../../support/Scheduler.js";const U="esri.views.3d.layers.support.FeatureTileFetcher3D",I=i.getLogger(U);let q=class extends t{set maximumNumberOfFeatures(e){e=e||1/0;const t=this._get("maximumNumberOfFeatures");e===t||e<1||(this._set("maximumNumberOfFeatures",e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set("memoryFactor",e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set("lodFactor",e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&a(this.context.query.queryFeatureCount)}set useTileCount(e){this._useTileCount=e,this.notifyChange("useTileCount")}get memoryForUnusedFeatures(){let e=0;return this._featureTiles.forEach((t=>e+=t.estimatedUnusedSize)),e}get totalVertices(){let e=0;return this._featureTiles.forEach((t=>e+=t.numVertices)),e}get totalFeatures(){let e=0;return this._featureTiles.forEach((t=>e+=t.numFeatures)),e}set filterExtent(e){if(a(e)&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference))return void I.error("#filterExtent=","extent needs to be in the same spatial reference as the tiling scheme");const t=this._get("filterExtent");if(t===e||a(t)&&e&&t.equals(e))return;const s=a(e)?e.clone():null;this._set("filterExtent",s),this._reclip(s,t)}constructor(e){super(e),this._useTileCount=!1,this.updating=!1,this.running=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this.maximumNumberOfFeaturesExceededThrottle=1e3,this._fullRatio=1,this._farRatio=1,this._changes={updates:{adds:new Array,removes:new Array},adds:new Array,removes:new Array},this._handles=new s,this._frameTask=P,this._dirty=!1,this._featureTiles=new Map,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._suspended=!0,this._pendingEdits=null}initialize(){this._handles.add(d((()=>this.tileDescriptors),"change",(()=>this._setDirty()),{onListenerAdd:()=>this._setDirty()})),this._objectIdField=this.context.objectIdField,this.FeatureReferenceClass=this.context.capabilities.supportsMultipleResolutions?v:M;const e=this.context.scheduler;a(e)&&(this._frameTask=e.registerTask(N.FEATURE_TILE_FETCHER,this)),this._setDirty()}destroy(){this._frameTask.remove(),this._handles=n(this._handles),this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._removeTile(e)})),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits&&(this._pendingEdits.controller.abort(),this._pendingEdits=null)}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)})),a(this.context.memoryCache)&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._resetFetchTile(e)})),a(this.context.memoryCache)&&this.context.memoryCache.clear(),this._setDirty()}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}_pause(){this._paused&&(this._featureTiles.forEach((e=>this._cancelFetchTile(e))),this._updated())}_unpause(){this._paused||(this._setDirty(),this._updated())}get availableFields(){let e=null;return this._featureTiles.forEach((t=>{o(t.displayingFeatures)||0===t.displayingFeatures.length||(o(e)?e=new Set(t.availableFields):e.forEach((s=>{t.availableFields.has(s)||u(e).delete(s)})))})),a(e)?e:new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());const t=this._pendingEdits;t.count++;const s=t.edits.then((()=>e.result.catch((e=>{if(l(e))throw e;return null})).then((e=>e?(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then((()=>e))):e)).then((e=>(0==--t.count&&(this._pendingEdits===t&&(this._pendingEdits=null),a(this.context.memoryCache)&&this.context.memoryCache.clear(),this._unpause(),this._updated()),e)))));return t.edits=s,this._updated(),s}_applyEditsDeleteFeatures(e){if(0===e.length)return;const t=this.context.globalIdField,s=t&&this.availableFields.has(t),i=new Set,r=this._objectIdField;e.forEach((({objectId:e,globalId:a})=>{if((!e||e<0)&&t){s||I.errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`);const e=this.features.find((e=>e.attributes&&e.attributes[t]===a));e&&i.add(x(e,r))}else i.add(e)})),this._featureTiles.forEach((e=>{if(!e.features)return;const t=e.features.filter((e=>!i.has(x(e,this._objectIdField))));t.length!==e.features.length&&(e.setFeatures(t,0,e.availableFields),this._invalidateCounts())}))}async _applyEditsAddUpdateFeatures(e,t,s){const i=[],r=new Set;if(e.forEach((e=>i.push(e.objectId))),t.forEach((e=>{i.push(e.objectId),r.add(e.objectId)})),0===i.length)return;const a=[];this._featureTiles.forEach((e=>{const t=this._applyEditsAddUpdateTile(e,i,r,s);t&&a.push(t)})),await h(a)}async _applyEditsAddUpdateTile(e,t,s,i){if(!e.features)return;const r=this._createQuery(e);r.resultType=void 0,r.cacheHint=!1,r.objectIds=t;const a=await this._queryFeatures(r,i);let n=null;if(s.size>0){const t=e.features.filter((e=>!s.has(x(e,this._objectIdField))));t.length!==e.features.length&&(n=t)}if(a.features.length>0){n||(n=e.features.slice());for(const e of a.features)n.push(e)}n&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,n.length)),e.setFeatures(n,0,z(e.availableFields,a.fields)),this._invalidateCounts())}_queryFeatures(e,t){return this.context.query.queryFeaturesDehydrated(e,{signal:t,timeout:X})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){if(this._frameTask.processQueue(e),!this._dirty||!this.initialized)return;this._dirty=!1;const t=this._getListOfTiles();if(this._markTilesNotAlive(t),!e.run((()=>this._addTiles(t,e)))||!e.run((()=>this._filterExtentTiles(t,e)))||!e.run((()=>this._removeTiles(t,e)))||e.done)return void this._setDirty();const s=this._sortTiles(t);e.run((()=>this._displayTiles(s,e)))&&e.run((()=>this._fetchTiles(s,e)))&&e.run((()=>this._updateMemoryEstimates(s,e)))||this._setDirty(),this._updated(),this.updating||this._updateMaximumNumberOfFeaturesExceeded()}_markTilesNotAlive(e){for(const t of e)t.alive=!1}_addTiles(e,t){return!this._suspended&&(this.tileDescriptors.forEach((s=>{const i=this._featureTiles.get(s.id);i?i.alive=!0:t.done||(e.push(this._addTile(s)),t.madeProgress())})),t.hasProgressed)}_filterExtentTiles(e,t){for(const s of e){if(t.done)break;s.alive&&(s.filtered=!s.intersects(this.filterExtent),s.filtered&&(this._clearTile(s),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let s=e.length-1;s>=0&&!t.done;s--){const i=e[s];i.alive||(this._removeTile(i),s!==e.length-1&&(e[s]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort(((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority)),e}_displayTiles(e,t){const s=this._updateRatio(e),i=e=>{const t=this._fullRatio<1?s(e)*this._farRatio:1;return e.reduceFeatures(t,this.memoryFactor,this._objectIdField)&&this._setDirty(),this._showTile(e)};for(const r of e)if(!t.run((()=>i(r)))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let s=!1;for(const i of e){if(!i.needsFetching)continue;const e=a(this.context.memoryCache)?this.context.memoryCache.pop(i.id):null;if(a(e))i.cache=e,this._setDirty(),this._scheduleUpdated(),t.madeProgress();else{if(this._needsNumFeatures(i)){const e=new AbortController,r=this._fetchTileCount(i,e.signal);this._handleRequest(i,r,e,(()=>i.numFeatures=D)),s=!0,t.madeProgress()}if(t.done)return!0}}if(s)return t.hasProgressed;for(const i of e)if(i.needsFetching){const e=new AbortController,s=this._fetchTile(i,e.signal);if(this._handleRequest(i,s,e,(e=>{i.setFeatures([],0,null),this._invalidateCounts(),i.featuresMissing=!1,this.context.logFetchError(I,e)})),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some((e=>!t.run((()=>e.updateMemoryEstimates()))&&(this._setDirty(),!0))),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;const s=new Array;this._featureTiles.forEach((i=>{o(i.displayingFeatures)||0===i.displayingFeatures.length||(i.intersectionIncludingBorrowed(t,B),i.intersectionIncludingBorrowed(e,G),g(B,G)||s.push(i))})),this._refreshDisplayingFeatures(s),this._updated()}_refreshDisplayingFeatures(e){const t=new Set,s=this._changes.updates;for(const i of e)if(!o(i.displayingFeatures))for(const e of i.displayingFeatures){const i=x(e,this._objectIdField);if(t.has(i))continue;t.add(i);const{feature:r}=this._displayingFeatureReferences.get(i);s.removes.push(r),s.adds.push(r)}this._applyChanges()}_updated(){let e=0;this._paused||this._featureTiles.forEach((t=>t.isFetching?++e:0));const t=this._dirty||!!this._pendingEdits||e>0;if(this._set("running",this._dirty),this._set("updating",t),t){let t=0,s=0,i=0,r=0,n=0;const o=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach((e=>{if(++s,e.isFetching&&e.hasPreciseFeatureCount){const t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),s=a(e.displayingFeatures)?e.displayingFeatures.length*o:0;n+=t-s}e.needsFetching?++r:e.numFeatures>0&&(++i,t+=e.numFeatures)})),r+=e;let u=0,l=0;t?(l=t,u=Math.min(r*t/i,t)):(l=s,u=r),n=Math.min(this.maximumNumberOfFeatures-this.features.length,n),this._set("updatingTotal",l),this._set("updatingRemaining",u),this._set("expectedFeatureDiff",n)}else this._set("updatingTotal",0),this._set("updatingRemaining",0),this._set("expectedFeatureDiff",0);this.debugger&&this.debugger.update()}_updateMaximumNumberOfFeaturesExceeded(){const e=r(this._featureTiles,(e=>e.perTileMaximumNumberOfFeaturesExceeded));this._set("maximumNumberOfFeaturesExceeded",e)}_updateRatio(e){const t=S(e),s=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0]));let i=0,r=0;for(const a of e){const e=a.numFeatures;i+=e,r+=e*s(a)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/i),this._farRatio=this.maximumNumberOfFeatures/r,this._scheduleUpdated(),s}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach((e=>{if(!e.featuresMissing)return;const t=this._maximumFeaturesForTile(e);e.features&&(e.features.length>=t||e.fetchStatus===w.FULL)||(this._cancelFetchTile(e),this._resetFetchTile(e))})),this._setDirty())}_addTile(e){const t=new O(e);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){const t=e.descriptor.resolution;this._featureTiles.forEach((s=>{if(!(o(s.displayingFeatures)||e===s||e.descriptor.lij&&s.descriptor.lij&&!j(e.descriptor.lij,s.descriptor.lij))){o(e.displayingFeatures)&&(e.displayingFeatures=[]),e.descriptor.extent&&s.descriptor.extent&&(o(e.extentIncludingBorrowedFeatures)&&(e.extentIncludingBorrowedFeatures=F(e.descriptor.extent)),y(e.extentIncludingBorrowedFeatures,s.descriptor.extent,e.extentIncludingBorrowedFeatures));for(const i of s.displayingFeatures){e.displayingFeatures.push(i);const s=this._displayingFeatureReferences.get(x(i,this._objectIdField));s.ref(s.feature,t),this._numDisplayingFeatureReferences++}}})),e.featureLimit=a(e.displayingFeatures)?e.displayingFeatures.length:0}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetching&&(e.fetchStatus=w.DONE):e.fetchStatus=w.FETCH_NEEDED}_cancelFetchTile(e){const t=e.requestController;a(t)&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){return e.numFeatures=await this._fetchCount(e,t),this._updateRatio(this._getListOfTiles()),e.fetchStatus===w.REFETCHING?w.REFETCH_NEEDED:w.FETCH_NEEDED}async _fetchTile(e,t){const s=this._maximumFeaturesForTile(e);if(s<=0)return H(e);const i=this._getMaxRecordCount(e),r=Math.ceil(s/i);if(A(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=s&&r>R.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);const a=this._createQuery(e);if(a.maxRecordCountFactor=Math.ceil(s/i),e.isRefetching&&e.features&&e.features.length>0){const t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/i);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}const{features:n,exceededTransferLimit:o,fields:u}=await this._queryFeatures(a,t),l=o?a.maxRecordCountFactor>=R.MAX_MAX_RECORD_COUNT_FACTOR?w.FULL:w.DONE:w.FULL;return await this._frameTask.schedule((()=>{e.featuresMissing=n.length<e.numFeatures||o;const t=this._removeEmptyFeatures(n);e.setFeatures(n,t,k(u))}),t),c(t),this._invalidateCounts(),l}async _fetchCount(e,t){return this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t})}async _fetchPagedTile(e,t){let s,i=0,r=0,a=0,n=this._maximumFeaturesForTile(e)-a;const o=this._getMaxRecordCount(e);let l=null;for(;;){const h=this._createQuery(e),d=this._setPagingParameters(h,i,n,o),{features:p,exceededTransferLimit:f,fields:m}=await this._queryFeatures(h,t);if(await this._frameTask.schedule((()=>{d&&(i+=u(h.num)),a+=p.length,r+=this._removeEmptyFeatures(p),e.featuresMissing=i<e.numFeatures||f,s=s?s.concat(p):p,l=z(l,m),e.setFeatures(s,r,l)}),t),c(t),this._invalidateCounts(),this._setDirty(),n=this._maximumFeaturesForTile(e)-a,!d||!f||n<=0)return f?w.DONE:w.FULL}}_createFeatureCountQuery(e){const t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e){const t=this.context.createQuery(),s=e.descriptor.extent;if(s){const e=this.context.tilingScheme.spatialReference;t.geometry=T(s,e)}return this._setResolutionParams(t,e),this._useTileQuery(e)?t.resultType="tile":this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),t}_setPagingParameters(e,t,s,i){return!!this.context.capabilities.supportsPagination&&(e.start=t,s>0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(s/i),e.num=Math.min(e.maxRecordCountFactor*i,s)):e.num=Math.min(i),!0)}_getEffectiveTileResolution(e){if(null==e.descriptor.resolution)return null;const t=this.context.viewingMode===b.Global?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.descriptor.resolution,t)/this.lodFactor}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&"point"!==this.context.geometryType}_setResolutionParams(e,t){if(!this._supportsResolution)return;const s=this._getEffectiveTileResolution(t);null!=s&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new C({mode:"view",originPosition:"upper-left",tolerance:s,extent:this.context.fullExtent}):"polyline"===this.context.geometryType&&(e.maxAllowableOffset=s))}_removeEmptyFeatures(e){const t=e.length;for(let s=0;s<e.length;){const t=e[s];E(t.geometry)?++s:(e[s]=e[e.length-1],--e.length)}return t-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!A(e)}_getMaxRecordCount(e){const{tileMaxRecordCount:t,maxRecordCount:s}=this.context;return this._useTileQuery(e)&&a(t)&&t>0&&this.context.capabilities.supportsResultType?t:a(s)&&s>0?s:V}_useTileQuery(e){return(!A(e)||!this.context.capabilities.supportsCacheHint)&&this.context.capabilities.supportsResultType}_handleRequest(e,t,s,i){e.fetchStatus=e.needsRefetching?w.REFETCHING:w.FETCHING,e.requestController=s;let r=!1;t.then((t=>{e.requestController=null,e.fetchStatus=t})).catch((t=>{e.requestController===s&&(e.requestController=null,e.fetchStatus=w.DONE),l(t)?r=!0:i(t)})).then((()=>{r||this._setDirty(),this._scheduleUpdated()}))}_scheduleUpdated(){this._handles&&!this._handles.has("scheduleUpdated")&&this._handles.add(p((()=>{this._handles.remove("scheduleUpdated"),this._updated()})),"scheduleUpdated")}_showTile(e){if(a(e.displayingFeatures)&&!e.needsDisplayUpdate)return!1;const t=e.features;if(0===e.featureLimit||!t){const t=a(e.displayingFeatures)&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}const s=e.descriptor.resolution,i=this._changes.updates,r=this._changes.adds,n=Math.min(e.featureLimit,t.length);e.featureLimit=n;for(let a=0;a<n;++a){const e=t[a],n=x(e,this._objectIdField),o=this._displayingFeatureReferences.get(n);if(o){const t=o.ref(e,s);t.oldVersion!==t.newVersion&&(i.removes.push(t.oldVersion),i.adds.push(t.newVersion))}else this._displayingFeatureReferences.set(n,new this.FeatureReferenceClass(e,s)),r.push(e);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),this._applyChanges(),e.displayingFeatures=t.slice(0,n),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(o(e.displayingFeatures))return;const t=this._changes.updates,s=this._changes.removes;for(const i of e.displayingFeatures){const r=x(i,this._objectIdField),a=this._displayingFeatureReferences.get(r);if(!a)continue;const n=a.unref(e.descriptor.resolution);this._numDisplayingFeatureReferences--,n?n.oldVersion!==n.newVersion&&(null==n.newVersion?(this._displayingFeatureReferences.delete(r),s.push(n.oldVersion)):(t.adds.push(n.newVersion),t.removes.push(n.oldVersion))):console.error("Hiding unreferenced feature")}this._applyChanges(),e.displayingFeatures=null}_applyChanges(){const e=this._changes.updates;e.removes.length>0&&(this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this.features.addMany(e.adds),e.adds.length=0);const t=this._changes.adds,s=this._changes.removes,i=Math.min(t.length,s.length);let r=0;for(;r<i;){const e=Math.min(r+$,i);this.features.addMany(t.slice(r,e)),this.features.removeMany(s.slice(r,e)),r=e}t.length>i&&this.features.addMany(0===r?t:t.slice(r)),s.length>i&&this.features.removeMany(0===r?s:s.slice(r)),t.length=0,s.length=0}_clearTile(e){if(this._hideTile(e),e.features&&a(this.context.memoryCache)){const t=16+e.estimatedSize;this.context.memoryCache.put(e.id,e.cache,t)}e.setFeatures(null,0,null),this._invalidateCounts()}_invalidateCounts(){this.notifyChange("totalVertices"),this.notifyChange("totalFeatures"),this.notifyChange("memoryForUnusedFeatures")}_getListOfTiles(){return Array.from(this._featureTiles.values())}get storedFeatures(){return this._getListOfTiles().reduce(((e,t)=>e+(t.features?t.features.length:0)),0)}_maximumFeaturesForTile(e){const t=e.hasPreciseFeatureCount?e.numFeatures:1/0,s=e.hasPreciseFeatureCount?t:this.maximumNumberOfFeatures,i=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(s*i/(1-e.emptyFeatureRatio)),t)}get test(){return{process:e=>this.runTask(e),getFeatureTileById:e=>this._featureTiles.get(e),forEachFeatureTile:e=>this._featureTiles.forEach(e)}}};function A(e){return"dummy-tile-full-extent"===e.id}function S(e){let t=0;for(const s of e)s.features&&s.features.length>0&&s.alive&&(t=Math.max(t,s.descriptor.lij[0]));return t}function L(e){const t=e.capabilities.query;return{supportsMultipleResolutions:Q(e),supportsPagination:!(!t||!t.supportsPagination),supportsResultType:!(!t||!t.supportsResultType),supportsCacheHint:!(!t||!t.supportsCacheHint),supportsQuantization:!(!t||!t.supportsQuantization),supportsQuantizationEditMode:!(!t||!t.supportsQuantizationEditMode),supportsMaxRecordCountFactor:!(!t||!t.supportsMaxRecordCountFactor),supportsFormatPBF:!(!t||!t.supportsFormatPBF)}}function Q(e){switch(e.geometryType){case"polyline":return!0;case"polygon":return e.capabilities&&e.capabilities.query&&e.capabilities.query.supportsQuantization;default:return!1}}function H(e){return e.setFeatures([],0,null),e.featuresMissing=!1,w.DONE}function k(e){return o(e)?new Set:new Set(e.map((e=>e.name)))}function z(e,t){if(o(e)||o(t))return k(t);const s=new Set;for(const{name:i}of t)e.has(i)&&s.add(i);return s}e([f({constructOnly:!0})],q.prototype,"features",void 0),e([f()],q.prototype,"tileDescriptors",void 0),e([f({value:1/0})],q.prototype,"maximumNumberOfFeatures",null),e([f({value:1})],q.prototype,"memoryFactor",null),e([f({value:1})],q.prototype,"lodFactor",null),e([f()],q.prototype,"useTileCount",null),e([f({readOnly:!0})],q.prototype,"updating",void 0),e([f({readOnly:!0})],q.prototype,"running",void 0),e([f({readOnly:!0})],q.prototype,"updatingTotal",void 0),e([f({readOnly:!0})],q.prototype,"updatingRemaining",void 0),e([f({readOnly:!0})],q.prototype,"expectedFeatureDiff",void 0),e([f({readOnly:!0})],q.prototype,"memoryForUnusedFeatures",null),e([f({readOnly:!0})],q.prototype,"maximumNumberOfFeaturesExceeded",void 0),e([f({constructOnly:!0})],q.prototype,"maximumNumberOfFeaturesExceededThrottle",void 0),e([f({readOnly:!0})],q.prototype,"totalVertices",null),e([f({readOnly:!0})],q.prototype,"totalFeatures",null),e([f()],q.prototype,"filterExtent",null),e([f({constructOnly:!0})],q.prototype,"context",void 0),q=e([m(U)],q);const V=2e3,B=_(),G=_(),X=6e5,$=200;export{q as FeatureTileFetcher3D,L as contextCapabilitiesFromLayer};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Handles.js";import i from"../../../../core/Logger.js";import{someMap as r}from"../../../../core/MapUtils.js";import{isSome as a,destroyMaybe as n,isNone as o,unwrap as u}from"../../../../core/maybe.js";import{isAbortError as l,eachAlways as h,throwIfAborted as c}from"../../../../core/promiseUtils.js";import{on as d}from"../../../../core/reactiveUtils.js";import{schedule as p}from"../../../../core/scheduling.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as _,equals as g,clone as F,expand as y,toExtent as T}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as x,hasVertices as E}from"../../../../layers/graphics/dehydratedFeatures.js";import C from"../../../../rest/support/QuantizationParameters.js";import R from"../../../../rest/support/Query.js";import{ViewingMode as b}from"../../../ViewingMode.js";import{MultiFeatureReference as v,SingleFeatureReference as M}from"./featureReference.js";import{FAILED_FEATURE_COUNT as D,FetchStatus as w,FeatureTile as O}from"./FeatureTile.js";import{tilesAreRelated as j}from"../../terrain/tileUtils.js";import{ImmediateTask as P,TaskPriority as N}from"../../../support/Scheduler.js";const U="esri.views.3d.layers.support.FeatureTileFetcher3D",I=i.getLogger(U);let q=class extends t{set maximumNumberOfFeatures(e){e=e||1/0;const t=this._get("maximumNumberOfFeatures");e===t||e<1||(this._set("maximumNumberOfFeatures",e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set("memoryFactor",e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set("lodFactor",e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&a(this.context.query.queryFeatureCount)}set useTileCount(e){this._useTileCount=e,this.notifyChange("useTileCount")}get memoryForUnusedFeatures(){let e=0;return this._featureTiles.forEach((t=>e+=t.estimatedUnusedSize)),e}get totalVertices(){let e=0;return this._featureTiles.forEach((t=>e+=t.numVertices)),e}get totalFeatures(){let e=0;return this._featureTiles.forEach((t=>e+=t.numFeatures)),e}set filterExtent(e){if(a(e)&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference))return void I.error("#filterExtent=","extent needs to be in the same spatial reference as the tiling scheme");const t=this._get("filterExtent");if(t===e||a(t)&&e&&t.equals(e))return;const s=a(e)?e.clone():null;this._set("filterExtent",s),this._reclip(s,t)}constructor(e){super(e),this._useTileCount=!1,this.updating=!1,this.running=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this.maximumNumberOfFeaturesExceededThrottle=1e3,this._fullRatio=1,this._farRatio=1,this._changes={updates:{adds:new Array,removes:new Array},adds:new Array,removes:new Array},this._handles=new s,this._frameTask=P,this._dirty=!1,this._featureTiles=new Map,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._suspended=!0,this._pendingEdits=null}initialize(){this._handles.add(d((()=>this.tileDescriptors),"change",(()=>this._setDirty()),{onListenerAdd:()=>this._setDirty()})),this._objectIdField=this.context.objectIdField,this.FeatureReferenceClass=this.context.capabilities.supportsMultipleResolutions?v:M;const e=this.context.scheduler;a(e)&&(this._frameTask=e.registerTask(N.FEATURE_TILE_FETCHER,this)),this._setDirty()}destroy(){this._frameTask.remove(),this._handles=n(this._handles),this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._removeTile(e)})),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)})),a(this.context.memoryCache)&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._resetFetchTile(e)})),a(this.context.memoryCache)&&this.context.memoryCache.clear(),this._setDirty()}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}_pause(){this._paused&&(this._featureTiles.forEach((e=>this._cancelFetchTile(e))),this._updated())}_unpause(){this._paused||(this._setDirty(),this._updated())}get availableFields(){let e=null;return this._featureTiles.forEach((t=>{o(t.displayingFeatures)||0===t.displayingFeatures.length||(o(e)?e=new Set(t.availableFields):e.forEach((s=>{t.availableFields.has(s)||u(e).delete(s)})))})),a(e)?e:new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());const t=this._pendingEdits;t.count++;const s=t.edits.then((()=>e.result.catch((e=>{if(l(e))throw e;return null})).then((e=>e?(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then((()=>e))):e)).then((e=>(0==--t.count&&(this._pendingEdits===t&&(this._pendingEdits=null),a(this.context.memoryCache)&&this.context.memoryCache.clear(),this._unpause(),this._updated()),e)))));return t.edits=s,this._updated(),s}_applyEditsDeleteFeatures(e){if(0===e.length)return;const t=this.context.globalIdField,s=t&&this.availableFields.has(t),i=new Set,r=this._objectIdField;e.forEach((({objectId:e,globalId:a})=>{if((!e||e<0)&&t){s||I.errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`);const e=this.features.find((e=>e.attributes&&e.attributes[t]===a));e&&i.add(x(e,r))}else i.add(e)})),this._featureTiles.forEach((e=>{if(!e.features)return;const t=e.features.filter((e=>!i.has(x(e,this._objectIdField))));t.length!==e.features.length&&(e.setFeatures(t,0,e.availableFields),this._invalidateCounts())}))}async _applyEditsAddUpdateFeatures(e,t,s){const i=[],r=new Set;if(e.forEach((e=>i.push(e.objectId))),t.forEach((e=>{i.push(e.objectId),r.add(e.objectId)})),0===i.length)return;const a=[];this._featureTiles.forEach((e=>{const t=this._applyEditsAddUpdateTile(e,i,r,s);t&&a.push(t)})),await h(a)}async _applyEditsAddUpdateTile(e,t,s,i){if(!e.features)return;const r=this._createQuery(e);r.resultType=void 0,r.cacheHint=!1,r.objectIds=t;const a=await this._queryFeatures(r,i);let n=null;if(s.size>0){const t=e.features.filter((e=>!s.has(x(e,this._objectIdField))));t.length!==e.features.length&&(n=t)}if(a.features.length>0){n||(n=e.features.slice());for(const e of a.features)n.push(e)}n&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,n.length)),e.setFeatures(n,0,k(e.availableFields,a.fields)),this._invalidateCounts())}_queryFeatures(e,t){return this.context.query.queryFeaturesDehydrated(e,{signal:t,timeout:X})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){if(this._frameTask.processQueue(e),!this._dirty||!this.initialized)return;this._dirty=!1;const t=this._getListOfTiles();if(this._markTilesNotAlive(t),!e.run((()=>this._addTiles(t,e)))||!e.run((()=>this._filterExtentTiles(t,e)))||!e.run((()=>this._removeTiles(t,e)))||e.done)return void this._setDirty();const s=this._sortTiles(t);e.run((()=>this._displayTiles(s,e)))&&e.run((()=>this._fetchTiles(s,e)))&&e.run((()=>this._updateMemoryEstimates(s,e)))||this._setDirty(),this._updated(),this.updating||this._updateMaximumNumberOfFeaturesExceeded()}_markTilesNotAlive(e){for(const t of e)t.alive=!1}_addTiles(e,t){return!this._suspended&&(this.tileDescriptors.forEach((s=>{const i=this._featureTiles.get(s.id);i?i.alive=!0:t.done||(e.push(this._addTile(s)),t.madeProgress())})),t.hasProgressed)}_filterExtentTiles(e,t){for(const s of e){if(t.done)break;s.alive&&(s.filtered=!s.intersects(this.filterExtent),s.filtered&&(this._clearTile(s),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let s=e.length-1;s>=0&&!t.done;s--){const i=e[s];i.alive||(this._removeTile(i),s!==e.length-1&&(e[s]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort(((e,t)=>(e.descriptor.loadPriority??0)-(t.descriptor.loadPriority??0))),e}_displayTiles(e,t){const s=this._updateRatio(e),i=e=>{const t=this._fullRatio<1?s(e)*this._farRatio:1;return e.reduceFeatures(t,this.memoryFactor,this._objectIdField)&&this._setDirty(),this._showTile(e)};for(const r of e)if(!t.run((()=>i(r)))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let s=!1;for(const i of e){if(!i.needsFetching)continue;const e=a(this.context.memoryCache)?this.context.memoryCache.pop(i.id):null;if(a(e))i.cache=e,this._setDirty(),this._scheduleUpdated(),t.madeProgress();else{if(this._needsNumFeatures(i)){const e=new AbortController,r=this._fetchTileCount(i,e.signal);this._handleRequest(i,r,e,(()=>i.numFeatures=D)),s=!0,t.madeProgress()}if(t.done)return!0}}if(s)return t.hasProgressed;for(const i of e)if(i.needsFetching){const e=new AbortController,s=this._fetchTile(i,e.signal);if(this._handleRequest(i,s,e,(e=>{i.setFeatures([],0,null),this._invalidateCounts(),i.featuresMissing=!1,this.context.logFetchError(I,e)})),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some((e=>!t.run((()=>e.updateMemoryEstimates()))&&(this._setDirty(),!0))),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;const s=new Array;this._featureTiles.forEach((i=>{o(i.displayingFeatures)||0===i.displayingFeatures.length||(i.intersectionIncludingBorrowed(t,B),i.intersectionIncludingBorrowed(e,G),g(B,G)||s.push(i))})),this._refreshDisplayingFeatures(s),this._updated()}_refreshDisplayingFeatures(e){const t=new Set,s=this._changes.updates;for(const i of e)if(!o(i.displayingFeatures))for(const e of i.displayingFeatures){const i=x(e,this._objectIdField);if(t.has(i))continue;t.add(i);const r=this._displayingFeatureReferences.get(i).feature;s.removes.push(r),s.adds.push(r)}this._applyChanges()}_updated(){let e=0;this._paused||this._featureTiles.forEach((t=>t.isFetching?++e:0));const t=this._dirty||!!this._pendingEdits||e>0;if(this._set("running",this._dirty),this._set("updating",t),t){let t=0,s=0,i=0,r=0,n=0;const o=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach((e=>{if(++s,e.isFetching&&e.hasPreciseFeatureCount){const t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),s=a(e.displayingFeatures)?e.displayingFeatures.length*o:0;n+=t-s}e.needsFetching?++r:e.numFeatures>0&&(++i,t+=e.numFeatures)})),r+=e;let u=0,l=0;t?(l=t,u=Math.min(r*t/i,t)):(l=s,u=r),n=Math.min(this.maximumNumberOfFeatures-this.features.length,n),this._set("updatingTotal",l),this._set("updatingRemaining",u),this._set("expectedFeatureDiff",n)}else this._set("updatingTotal",0),this._set("updatingRemaining",0),this._set("expectedFeatureDiff",0);this.debugger&&this.debugger.update()}_updateMaximumNumberOfFeaturesExceeded(){const e=r(this._featureTiles,(e=>e.perTileMaximumNumberOfFeaturesExceeded));this._set("maximumNumberOfFeaturesExceeded",e)}_updateRatio(e){const t=S(e),s=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0]));let i=0,r=0;for(const a of e){const e=a.numFeatures;i+=e,r+=e*s(a)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/i),this._farRatio=this.maximumNumberOfFeatures/r,this._scheduleUpdated(),s}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach((e=>{if(!e.featuresMissing)return;const t=this._maximumFeaturesForTile(e);e.features&&(e.features.length>=t||e.fetchStatus===w.FULL)||(this._cancelFetchTile(e),this._resetFetchTile(e))})),this._setDirty())}_addTile(e){const t=new O(e);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){const t=e.descriptor.resolution;this._featureTiles.forEach((s=>{if(!(o(s.displayingFeatures)||e===s||e.descriptor.lij&&s.descriptor.lij&&!j(e.descriptor.lij,s.descriptor.lij))){o(e.displayingFeatures)&&(e.displayingFeatures=[]),e.descriptor.extent&&s.descriptor.extent&&(o(e.extentIncludingBorrowedFeatures)&&(e.extentIncludingBorrowedFeatures=F(e.descriptor.extent)),y(e.extentIncludingBorrowedFeatures,s.descriptor.extent,e.extentIncludingBorrowedFeatures));for(const i of s.displayingFeatures){e.displayingFeatures.push(i);const s=this._displayingFeatureReferences.get(x(i,this._objectIdField));s.ref(s.feature,t),this._numDisplayingFeatureReferences++}}})),e.featureLimit=a(e.displayingFeatures)?e.displayingFeatures.length:0}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetching&&(e.fetchStatus=w.DONE):e.fetchStatus=w.FETCH_NEEDED}_cancelFetchTile(e){const t=e.requestController;a(t)&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){return e.numFeatures=await this._fetchCount(e,t),this._updateRatio(this._getListOfTiles()),e.fetchStatus===w.REFETCHING?w.REFETCH_NEEDED:w.FETCH_NEEDED}async _fetchTile(e,t){const s=this._maximumFeaturesForTile(e);if(s<=0)return V(e);const i=this._getMaxRecordCount(e),r=Math.ceil(s/i);if(A(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=s&&r>R.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);const a=this._createQuery(e);if(a.maxRecordCountFactor=Math.ceil(s/i),e.isRefetching&&e.features&&e.features.length>0){const t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/i);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}const{features:n,exceededTransferLimit:o,fields:u}=await this._queryFeatures(a,t),l=o?a.maxRecordCountFactor>=R.MAX_MAX_RECORD_COUNT_FACTOR?w.FULL:w.DONE:w.FULL;return await this._frameTask.schedule((()=>{e.featuresMissing=n.length<e.numFeatures||!!o;const t=this._removeEmptyFeatures(n);e.setFeatures(n,t,H(u))}),t),c(t),this._invalidateCounts(),l}async _fetchCount(e,t){return this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t})}async _fetchPagedTile(e,t){let s,i=0,r=0,a=0,n=this._maximumFeaturesForTile(e)-a;const o=this._getMaxRecordCount(e);let l=null;for(;;){const h=this._createQuery(e),d=this._setPagingParameters(h,i,n,o),{features:p,exceededTransferLimit:f,fields:m}=await this._queryFeatures(h,t);if(await this._frameTask.schedule((()=>{d&&(i+=u(h.num)),a+=p.length,r+=this._removeEmptyFeatures(p),e.featuresMissing=i<e.numFeatures||!!f,s=s?s.concat(p):p,l=k(l,m),e.setFeatures(s,r,l)}),t),c(t),this._invalidateCounts(),this._setDirty(),n=this._maximumFeaturesForTile(e)-a,!d||!f||n<=0)return f?w.DONE:w.FULL}}_createFeatureCountQuery(e){const t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e){const t=this.context.createQuery(),s=e.descriptor.extent;if(s){const e=this.context.tilingScheme.spatialReference;t.geometry=T(s,e)}return this._setResolutionParams(t,e),this._useTileQuery(e)?t.resultType="tile":this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),t}_setPagingParameters(e,t,s,i){return!!this.context.capabilities.supportsPagination&&(e.start=t,s>0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(s/i),e.num=Math.min(e.maxRecordCountFactor*i,s)):e.num=Math.min(i),!0)}_getEffectiveTileResolution(e){if(null==e.descriptor.resolution)return null;const t=this.context.viewingMode===b.Global?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.descriptor.resolution,t)/this.lodFactor}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&"point"!==this.context.geometryType}_setResolutionParams(e,t){if(!this._supportsResolution)return;const s=this._getEffectiveTileResolution(t);null!=s&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new C({mode:"view",originPosition:"upper-left",tolerance:s,extent:this.context.fullExtent}):"polyline"===this.context.geometryType&&(e.maxAllowableOffset=s))}_removeEmptyFeatures(e){const t=e.length;for(let s=0;s<e.length;){const t=e[s];E(t.geometry)?++s:(e[s]=e[e.length-1],--e.length)}return t-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!A(e)}_getMaxRecordCount(e){const{tileMaxRecordCount:t,maxRecordCount:s}=this.context;return this._useTileQuery(e)&&a(t)&&t>0&&this.context.capabilities.supportsResultType?t:a(s)&&s>0?s:z}_useTileQuery(e){return(!A(e)||!this.context.capabilities.supportsCacheHint)&&this.context.capabilities.supportsResultType}_handleRequest(e,t,s,i){e.fetchStatus=e.needsRefetching?w.REFETCHING:w.FETCHING,e.requestController=s;let r=!1;t.then((t=>{e.requestController=null,e.fetchStatus=t})).catch((t=>{e.requestController===s&&(e.requestController=null,e.fetchStatus=w.DONE),l(t)?r=!0:i(t)})).then((()=>{r||this._setDirty(),this._scheduleUpdated()}))}_scheduleUpdated(){this._handles&&!this._handles.has("scheduleUpdated")&&this._handles.add(p((()=>{this._handles.remove("scheduleUpdated"),this._updated()})),"scheduleUpdated")}_showTile(e){if(a(e.displayingFeatures)&&!e.needsDisplayUpdate)return!1;const t=e.features;if(0===e.featureLimit||!t){const t=a(e.displayingFeatures)&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}const s=e.descriptor.resolution,i=this._changes.updates,r=this._changes.adds,n=Math.min(e.featureLimit,t.length);e.featureLimit=n;for(let a=0;a<n;++a){const e=t[a],n=x(e,this._objectIdField),o=this._displayingFeatureReferences.get(n);if(o){const t=o.ref(e,s);t.oldVersion!==t.newVersion&&(t.oldVersion&&i.removes.push(t.oldVersion),t.newVersion&&i.adds.push(t.newVersion))}else this._displayingFeatureReferences.set(n,new this.FeatureReferenceClass(e,s)),r.push(e);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),this._applyChanges(),e.displayingFeatures=t.slice(0,n),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(o(e.displayingFeatures))return;const t=this._changes.updates,s=this._changes.removes;for(const i of e.displayingFeatures){const r=x(i,this._objectIdField),a=this._displayingFeatureReferences.get(r);if(!a)continue;const n=a.unref(e.descriptor.resolution);this._numDisplayingFeatureReferences--,n?n.oldVersion!==n.newVersion&&(null==n.newVersion?(this._displayingFeatureReferences.delete(r),n.oldVersion&&s.push(n.oldVersion)):(t.adds.push(n.newVersion),n.oldVersion&&t.removes.push(n.oldVersion))):console.error("Hiding unreferenced feature")}this._applyChanges(),e.displayingFeatures=null}_applyChanges(){const e=this._changes.updates;e.removes.length>0&&(this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this.features.addMany(e.adds),e.adds.length=0);const t=this._changes.adds,s=this._changes.removes,i=Math.min(t.length,s.length);let r=0;for(;r<i;){const e=Math.min(r+$,i);this.features.addMany(t.slice(r,e)),this.features.removeMany(s.slice(r,e)),r=e}t.length>i&&this.features.addMany(0===r?t:t.slice(r)),s.length>i&&this.features.removeMany(0===r?s:s.slice(r)),t.length=0,s.length=0}_clearTile(e){if(this._hideTile(e),e.features&&a(this.context.memoryCache)){const t=16+e.estimatedSize;this.context.memoryCache.put(e.id,e.cache,t)}e.setFeatures(null,0,null),this._invalidateCounts()}_invalidateCounts(){this.notifyChange("totalVertices"),this.notifyChange("totalFeatures"),this.notifyChange("memoryForUnusedFeatures")}_getListOfTiles(){return Array.from(this._featureTiles.values())}get storedFeatures(){return this._getListOfTiles().reduce(((e,t)=>e+(t.features?t.features.length:0)),0)}_maximumFeaturesForTile(e){const t=e.hasPreciseFeatureCount?e.numFeatures:1/0,s=e.hasPreciseFeatureCount?t:this.maximumNumberOfFeatures,i=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(s*i/(1-e.emptyFeatureRatio)),t)}get test(){return{process:e=>this.runTask(e),getFeatureTileById:e=>this._featureTiles.get(e),forEachFeatureTile:e=>this._featureTiles.forEach(e)}}};function A(e){return"dummy-tile-full-extent"===e.id}function S(e){let t=0;for(const s of e)s.features&&s.features.length>0&&s.alive&&(t=Math.max(t,s.descriptor.lij[0]));return t}function L(e){const t=e.capabilities.query;return{supportsMultipleResolutions:Q(e),supportsPagination:!(!t||!t.supportsPagination),supportsResultType:!(!t||!t.supportsResultType),supportsCacheHint:!(!t||!t.supportsCacheHint),supportsQuantization:!(!t||!t.supportsQuantization),supportsQuantizationEditMode:!(!t||!t.supportsQuantizationEditMode),supportsMaxRecordCountFactor:!(!t||!t.supportsMaxRecordCountFactor),supportsFormatPBF:!(!t||!t.supportsFormatPBF)}}function Q(e){switch(e.geometryType){case"polyline":return!0;case"polygon":return e.capabilities&&e.capabilities.query&&e.capabilities.query.supportsQuantization;default:return!1}}function V(e){return e.setFeatures([],0,null),e.featuresMissing=!1,w.DONE}function H(e){return o(e)?new Set:new Set(e.map((e=>e.name)))}function k(e,t){if(o(e)||o(t))return H(t);const s=new Set;for(const{name:i}of t)e.has(i)&&s.add(i);return s}e([f({constructOnly:!0})],q.prototype,"features",void 0),e([f()],q.prototype,"tileDescriptors",void 0),e([f({value:1/0})],q.prototype,"maximumNumberOfFeatures",null),e([f({value:1})],q.prototype,"memoryFactor",null),e([f({value:1})],q.prototype,"lodFactor",null),e([f()],q.prototype,"useTileCount",null),e([f({readOnly:!0})],q.prototype,"updating",void 0),e([f({readOnly:!0})],q.prototype,"running",void 0),e([f({readOnly:!0})],q.prototype,"updatingTotal",void 0),e([f({readOnly:!0})],q.prototype,"updatingRemaining",void 0),e([f({readOnly:!0})],q.prototype,"expectedFeatureDiff",void 0),e([f({readOnly:!0})],q.prototype,"memoryForUnusedFeatures",null),e([f({readOnly:!0})],q.prototype,"maximumNumberOfFeaturesExceeded",void 0),e([f({constructOnly:!0})],q.prototype,"maximumNumberOfFeaturesExceededThrottle",void 0),e([f({readOnly:!0})],q.prototype,"totalVertices",null),e([f({readOnly:!0})],q.prototype,"totalFeatures",null),e([f()],q.prototype,"filterExtent",null),e([f({constructOnly:!0})],q.prototype,"context",void 0),q=e([m(U)],q);const z=2e3,B=_(),G=_(),X=6e5,$=200;export{q as FeatureTileFetcher3D,L as contextCapabilitiesFromLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Graphic.js";import{isNone as t}from"../../../../core/maybe.js";import i from"../../../../geometry/Polygon.js";import s from"../../../../symbols/FillSymbol3DLayer.js";import
|
|
5
|
+
import e from"../../../../Graphic.js";import{isNone as t}from"../../../../core/maybe.js";import i from"../../../../geometry/Polygon.js";import s from"../../../../symbols/FillSymbol3DLayer.js";import a from"../../../../symbols/PointSymbol3D.js";import o from"../../../../symbols/PolygonSymbol3D.js";import r from"../../../../symbols/TextSymbol3DLayer.js";import{TilingScheme as h}from"../../terrain/TilingScheme.js";const l=[[0,179,255],[117,62,128],[0,104,255],[215,189,166],[32,0,193],[98,162,206],[102,112,129],[52,125,0],[142,118,246],[138,83,0],[92,122,255],[122,55,83],[0,142,255],[81,40,179],[0,200,244],[13,24,127],[0,170,147],[19,58,241],[22,44,35]];class n{constructor(e,t,i){this._loadingGraphics=new Map,this._loadedGraphics=new Map,this._pendingGraphics=new Map,this._dataExtentGraphic=null,this._enabled=!0,this._tileFetcher=e,this._view=i,this._tilingScheme=new h(t),this._loadedSymbols=l.map((e=>new o(new s({material:{color:[e[0],e[1],e[2],.6]},outline:{color:"black",size:1}})))),this._loadingSymbols=[new o(new s({material:{color:[200,200,200,.4]},outline:{color:[30,30,30],size:1}}))],this._pendingSymbols=[new o(new s({material:{color:[100,100,100,.4]},outline:{color:[30,30,30],size:1}}))],this._dataExtentSymbol=new o(new s({material:{color:[0,0,0,0]},outline:{color:"green",size:4}}))}destroy(){this.enabled=!1}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}update(){this._enabled?(this._synchronizeMaps(this._loadingGraphics,{filter:e=>e.isFetching,symbols:this._loadingSymbols}),this._synchronizeMaps(this._loadedGraphics,{filter:e=>!e.isFetching,symbols:this._loadedSymbols}),this._synchronizeMaps(this._pendingGraphics,{filter:e=>!e.isFetching,symbols:this._pendingSymbols}),this.showDataExtent(this._tileFetcher.filterExtent)):(this._loadingGraphics.forEach((e=>{this._view.graphics.removeMany(e)})),this._loadingGraphics.clear(),this._loadedGraphics.forEach((e=>{this._view.graphics.removeMany(e)})),this._loadedGraphics.clear(),this._pendingGraphics.forEach((e=>{this._view.graphics.removeMany(e)})),this._pendingGraphics.clear(),this._dataExtentGraphic&&(this._view.graphics.remove(this._dataExtentGraphic),this._dataExtentGraphic=null))}showDataExtent(s){if(this._dataExtentGraphic&&(this._view.graphics.remove(this._dataExtentGraphic),this._dataExtentGraphic=null),t(s))return;const a=i.fromExtent(s);this._dataExtentGraphic=new e({geometry:a,symbol:this._dataExtentSymbol}),this._view.graphics.add(this._dataExtentGraphic)}_synchronizeMaps(t,i){const s=[];t.forEach(((e,t)=>{const a=this._tileFetcher.test.getFeatureTileById(t);a&&i.filter(a)||(this._view.graphics.removeMany(e),s.push(t))})),s.forEach((e=>t.delete(e))),this._tileFetcher.test.forEachFeatureTile((s=>{if(i.filter(s)&&!t.has(s.id)){const[o,h,l]=s.descriptor.lij;this._tilingScheme.ensureMaxLod(o);const n=this._tilingScheme.getExtentGeometry(o,h,l),c=[new e({geometry:n,symbol:i.symbols[o%i.symbols.length]}),new e({geometry:n.center,symbol:new a({verticalOffset:{screenLength:40/.75},callout:{type:"line",color:"white",border:{color:"black"}},symbolLayers:[new r({text:`${o}/${h}/${l}`,halo:{color:"white",size:1/.75},material:{color:"black"},size:16})]})})];t.set(s.id,c),this._view.graphics.addMany(c)}}))}}export{n as FeatureTileFetcher3DDebugger};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import e from"../../../../core/Handles.js";import{
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import e from"../../../../core/Handles.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{initial as o}from"../../../../core/reactiveUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{WatchUpdatingTracking as a}from"../../../../core/support/WatchUpdatingTracking.js";import{TileTreeDebugger as p}from"../../../support/TileTreeDebugger.js";import n from"../../../../geometry/Polygon.js";let c=class extends p{get updating(){return this._watchUpdatingTracking?.updating??!1}constructor(t){super(t),this._watchUpdatingTracking=new a,this._handles=new e}initialize(){const{featureTiles:t}=this.view;this._handles.add(t.addClient()),this._watchUpdatingTracking.addOnCollectionChange((()=>t?.tiles),(()=>this.update()),o)}destroy(){this._handles=r(this._handles),this._watchUpdatingTracking.destroy()}getTiles(){const t=t=>{const[e,r,o]=t.lij;return n.fromExtent(this.view.featureTiles.tilingScheme.getExtentGeometry(e,r,o))};return this.view.featureTiles.tiles.toArray().sort(((t,e)=>t.loadPriority-e.loadPriority)).map((e=>({...e,geometry:t(e)})))}};t([i()],c.prototype,"_watchUpdatingTracking",void 0),t([i()],c.prototype,"updating",null),t([i()],c.prototype,"view",void 0),c=t([s("esri.views.3d.layers.support.FeatureTileTree3DDebugger")],c);export{c as FeatureTileTree3DDebugger};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{estimateAttributesObjectSize as t,estimateFixedArraySize as r,estimateNumberByteSize as i}from"../../../../core/byteSizeEstimations.js";import{HandleOwner as a}from"../../../../core/HandleOwner.js";import{makeHandle as s}from"../../../../core/handleUtils.js";import o from"../../../../core/Logger.js";import{isSome as n,disposeMaybe as l,isNone as p,unwrap as d,applySome as m,mapSome as u}from"../../../../core/maybe.js";import{initial as h,sync as c,watch as y}from"../../../../core/reactiveUtils.js";import{pt2px as _}from"../../../../core/screenUtils.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as g}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as F}from"../../../../chunks/vec3.js";import{c as b}from"../../../../chunks/vec3f64.js";import{projectPointToVector as R}from"../../../../geometry/projection.js";import{getResolutionForScale as v}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as S}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as w}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as P}from"../../../../layers/graphics/OptimizedFeature.js";import j from"../../../../layers/graphics/OptimizedGeometry.js";import T from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as V}from"../../../../layers/support/fieldUtils.js";import{generateGradient as x}from"../../../../renderers/support/heatmapUtils.js";import{DrapeSourceType as G}from"../interfaces.js";import{FeatureVisibilityFilter as M}from"./FeatureVisibilityFilter.js";import{DRAPED_Z as I}from"../../terrain/OverlayRenderer.js";import{Attribute as N}from"../../webgl-engine/lib/Attribute.js";import{UpdatePolicy as O}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as A}from"../../webgl-engine/lib/ContentObjectType.js";import{DrapedHeatmapRenderer as C}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as E}from"../../webgl-engine/lib/Geometry.js";import{DirtyOperation as U,DirtyState as H}from"../../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as D}from"../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as L}from"../../webgl-engine/lib/VertexAttribute.js";import{HeatmapDensityMaterial as W}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as B,isScaleRangeActive as Z}from"../../../support/layerViewUtils.js";import{PixelType as z,PixelFormat as $}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as k}from"../../../webgl/heatmapTextureUtils.js";const q="esri.views.3d.layers.support.HeatmapFeatureProcessor",Y=o.getLogger(q),J=112;let K=class extends a{constructor(e){super(e),this.type="heatmap",this.preferredUpdatePolicy=O.ASYNC,this.dataExtent=null,this.drapeSourceType=G.Features,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=z.HALF_FLOAT,this._pixelFormat=$.RGBA,this.initializePromise=Promise.resolve()}initialize(){this._featureStore=new T({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM});const{dataType:e,samplingMode:t,pixelFormat:r,internalFormat:i}=k(this._renderView.renderingContext,Y);this._dataType=e,this._pixelFormat=r;const a=e!==z.FLOAT;this._drapeSourceRenderer=this.view.basemapTerrain.overlayManager.registerDrapeSource(this,C,{...this._rendererParameters,dataType:e,samplingMode:t,pixelFormat:r,internalFormat:i}),this._material=new W({usesHalfFloats:a}),this._materialWithField=new W({usesHalfFloats:a,isAttributeDriven:!0}),this._filterVisibility=new M({context:{layerView:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this.updatingHandles.addOnCollectionChange((()=>this._loadedPointGraphics),(e=>this._onLoadedFeaturesChange(e)),h),this.updatingHandles.addWhen((()=>this._materialParameters),(e=>this._forEachMaterial((t=>t.setParameters(e)))),h),this.updatingHandles.add((()=>this._rendererParameters),(e=>this._drapeSourceRenderer.set(e))),this.updatingHandles.add((()=>this._heatmapRendererField),(()=>{this._recreate()}),c),this.updatingHandles.add((()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric})),(({fieldName:e,numeric:t})=>{if(n(e)&&t){let t=0;this._featureStore.forEach((r=>t+=r.attributes[e]??0)),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures}),h),this.handles.add([y((()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField})),(({fieldName:e,field:t})=>{e&&!t&&Y.warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)})),y((()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric})),(({field:e,numeric:t})=>{n(e)&&!t&&Y.warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)})),s((()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this)))])}destroy(){this._renderGeometries.clear(),this._material=l(this._material),this._materialWithField=l(this._materialWithField),this._featureStore.clear(),this._featureStore=null}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this.updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){const e=this.owner?.view?.resourceController?.memoryController?.memoryFactor??1,t=this.owner?.view?.qualitySettings,r=t?Math.ceil(t.heatmap.maxTotalNumberOfFeatures*e):0;return{minimumTotalNumberOfFeatures:0,maximumTotalNumberOfFeatures:r,maximumTotalNumberOfPrimitives:r*2,maximumNumberOfFeatures:r}}get hasZ(){return"hasZ"in this.layer&&this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;const{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:r}=this.view;return!B(r,e??0,t??0)}get usedMemory(){const e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=this._pixelFormat===$.RED?1:4,r=this._dataType===z.FLOAT?4:2,i=Math.ceil(this._overlayRenderer?.overlays[0]?.resolution*this._densityMapPixelRatio)??0;return i*i*t*r+e}get usedMemoryPerFeature(){const e=this._loadedPointGraphics.find((()=>!0));if(p(e))return 0;const a=t(e),s=i(),o=6;return o*r([0,0,0],s)+o*r([0,0],s)+(this._heatmapRendererFieldIsNumeric?o*s:0)+a}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return{core:{visible:this._visibleFeatures,missing:0,pending:0},elevationUpdating:!1,visibilityFrustum:!0,visibilityScale:!0}}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return d(this._overlayRenderer.spatialReference)}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const e=this._heatmapRenderer;if(p(e))return null;const{minDensity:t,maxDensity:r}=e;return{minDensity:t,maxDensity:r,fieldTotal:this._fieldTotal}}get _radiusParameter(){return m(this._heatmapRenderer,(({radius:e})=>({searchRadius:_(this._clampSearchRadius(e))})))}get _resolutionForScaleParameter(){return m(this._heatmapRenderer,(({referenceScale:e})=>({resolutionForScale:0===e?0:v(e,this.view.spatialReference)})))}get _colorRampParameter(){return m(this._heatmapRenderer,(e=>({colorRampData:x(e.colorStops)})))}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){const e=this.owner?.view?.resourceController?.memoryController?.memoryFactor??1;return(this.owner?.view?.qualitySettings.heatmap.pixelRatio??1)*Math.sqrt(e)}get _renderView(){return this.view._stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===e?.type?e:null}get _heatmapRendererFieldName(){return m(this._heatmapRenderer,(e=>e.field))}get _heatmapRendererField(){return m(this._heatmapRendererFieldName,(e=>this.layer.fieldsIndex.get(e)))}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return!p(e)&&V(e)}get _isScaleRangeActive(){const{layer:e}=this;if(!("effectiveScaleRange"in e))return!1;const{minScale:t,maxScale:r}=e.effectiveScaleRange;return Z(t,r)}get _visibleFeatures(){let e=0;return this._renderGeometries.forEach((t=>{t.visible&&++e})),e}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlight(){return Q}maskOccludee(){return Q}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:t}=this.layer;this._featureStore.removeManyById(e.removed.map((e=>S(e,t)))),this._featureStore.addMany(e.added.map((e=>{const r=new P(w(new j,e.geometry),e.attributes,m(e.centroid,(e=>w(new j,e))),S(e,t));return r.displayId=e.uid,r})));const r=e.added,i=e.removed;this._fieldTotal+=this._computeFieldTotalChange(r,i);const a=u(i,(({uid:e})=>{const t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t})),s=r.map((e=>{const t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t}));a.length>0&&this._drapeSourceRenderer.removeGeometries(a,U.REMOVE),s.length>0&&this._drapeSourceRenderer.addGeometries(s,U.ADD),(s.length>0||a.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const t=this._heatmapRendererFieldName,r=n(t)?this._materialWithField:this._material,i=b();R(e.geometry,i,this._overlaySpatialReference),i[2]=I;const a=[[L.POSITION,new N(i,i.length)]],s=this._heatmapRendererFieldIsNumeric;n(t)&&a.push([L.FEATUREATTRIBUTE,new N([s?e.attributes[t]??0:0],1)]);const o=new D(new E(r,a,null,null,A.Point),{layerUid:this.layer.uid,graphicUid:e.uid});return F(o.boundingSphere,i),o.visible=this.filterVisibility.defaultVisibility,o}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(p(this._heatmapRendererFieldName)||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;const r=this._heatmapRendererFieldName,i=(e,t)=>e+(t.attributes[r]??0);return e.reduce(i,0)-t.reduce(i,0)}_clampSearchRadius(e){return e>J&&Y.warnOnce(`SceneView supports a maximum radius of ${J} pt for HeatmapRenderer.`),Math.min(e,J)}_updateFeatureVisibilities(e){const t=[];this._featureStore.forEach((({objectId:r,displayId:i})=>{const a=e(r),s=this._renderGeometries.get(i);s.visible!==a&&(t.push(s),s.visible=a)})),this._drapeSourceRenderer.modifyGeometries(t,H.VISIBILITY)}_setAllFeaturesVisibility(e){const t=[];for(const r of this._renderGeometries.values())r.visible!==e&&(t.push(r),r.visible=e);this._drapeSourceRenderer.modifyGeometries(t,H.VISIBILITY)}get test(){return{visibleFeatureCount:this._visibleFeatures}}};e([f()],K.prototype,"type",void 0),e([f({constructOnly:!0})],K.prototype,"owner",void 0),e([f()],K.prototype,"layer",null),e([f()],K.prototype,"featureStore",null),e([f()],K.prototype,"updating",null),e([f()],K.prototype,"updatingRemaining",null),e([f()],K.prototype,"suspendInfo",null),e([f()],K.prototype,"legendEnabled",null),e([f()],K.prototype,"filterVisibility",null),e([f()],K.prototype,"displayFeatureLimit",null),e([f()],K.prototype,"preferredUpdatePolicy",void 0),e([f()],K.prototype,"hasZ",null),e([f()],K.prototype,"hasM",null),e([f()],K.prototype,"dataExtent",void 0),e([f()],K.prototype,"view",null),e([f()],K.prototype,"fullOpacity",null),e([f()],K.prototype,"updatePolicy",null),e([f()],K.prototype,"drapeSourceType",void 0),e([f()],K.prototype,"scaleVisibilitySuspended",null),e([f()],K.prototype,"renderer",null),e([f()],K.prototype,"_featureStore",void 0),e([f()],K.prototype,"_filterVisibility",void 0),e([f()],K.prototype,"_overlayRenderer",null),e([f()],K.prototype,"_overlaySpatialReference",null),e([f()],K.prototype,"_rendererParameters",null),e([f()],K.prototype,"_materialParameters",null),e([f()],K.prototype,"_densityParameters",null),e([f()],K.prototype,"_radiusParameter",null),e([f()],K.prototype,"_resolutionForScaleParameter",null),e([f()],K.prototype,"_colorRampParameter",null),e([f()],K.prototype,"_pixelRatioParameter",null),e([f()],K.prototype,"_densityMapPixelRatio",null),e([f()],K.prototype,"_renderGeometries",void 0),e([f()],K.prototype,"_material",void 0),e([f()],K.prototype,"_materialWithField",void 0),e([f()],K.prototype,"_renderView",null),e([f()],K.prototype,"_featuresArePoints",null),e([f()],K.prototype,"_loadedPointGraphics",null),e([f()],K.prototype,"_heatmapRenderer",null),e([f()],K.prototype,"_heatmapRendererFieldName",null),e([f()],K.prototype,"_heatmapRendererField",null),e([f()],K.prototype,"_heatmapRendererFieldIsNumeric",null),e([f()],K.prototype,"_fieldTotal",void 0),e([f()],K.prototype,"_drapeSourceRenderer",void 0),e([f()],K.prototype,"_isScaleRangeActive",null),K=e([g(q)],K);const Q=s();export{K as HeatmapFeatureProcessor,J as MAX_RADIUS_PT};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{estimateAttributesObjectSize as t,estimateFixedArraySize as r,estimateNumberByteSize as i}from"../../../../core/byteSizeEstimations.js";import{HandleOwner as a}from"../../../../core/HandleOwner.js";import{makeHandle as s}from"../../../../core/handleUtils.js";import o from"../../../../core/Logger.js";import{isSome as n,disposeMaybe as l,isNone as p,unwrap as d,applySome as m,mapSome as u}from"../../../../core/maybe.js";import{initial as h,sync as c,watch as y}from"../../../../core/reactiveUtils.js";import{pt2px as _}from"../../../../core/screenUtils.js";import{property as f}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as g}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as F}from"../../../../chunks/vec3.js";import{c as b}from"../../../../chunks/vec3f64.js";import{projectPointToVector as R}from"../../../../geometry/projection.js";import{getResolutionForScale as v}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as S}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as w}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as P}from"../../../../layers/graphics/OptimizedFeature.js";import j from"../../../../layers/graphics/OptimizedGeometry.js";import T from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as V}from"../../../../layers/support/fieldUtils.js";import{generateGradient as x}from"../../../../renderers/support/heatmapUtils.js";import{DrapeSourceType as G}from"../interfaces.js";import{FeatureVisibilityFilter as M}from"./FeatureVisibilityFilter.js";import{DRAPED_Z as I}from"../../terrain/OverlayRenderer.js";import{Attribute as N}from"../../webgl-engine/lib/Attribute.js";import{UpdatePolicy as O}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as A}from"../../webgl-engine/lib/ContentObjectType.js";import{DrapedHeatmapRenderer as C}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as E}from"../../webgl-engine/lib/Geometry.js";import{DirtyOperation as U,DirtyState as H}from"../../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as D}from"../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as L}from"../../webgl-engine/lib/VertexAttribute.js";import{HeatmapDensityMaterial as W}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as B,isScaleRangeActive as Z}from"../../../support/layerViewUtils.js";import{PixelType as z,PixelFormat as $}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as k}from"../../../webgl/heatmapTextureUtils.js";const q="esri.views.3d.layers.support.HeatmapFeatureProcessor",Y=o.getLogger(q),J=112;let K=class extends a{constructor(e){super(e),this.type="heatmap",this.preferredUpdatePolicy=O.ASYNC,this.dataExtent=null,this.drapeSourceType=G.Features,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=z.HALF_FLOAT,this._pixelFormat=$.RGBA,this.initializePromise=Promise.resolve()}initialize(){this._featureStore=new T({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM});const{dataType:e,samplingMode:t,pixelFormat:r,internalFormat:i}=k(this._renderView.renderingContext,Y);this._dataType=e,this._pixelFormat=r;const a=e!==z.FLOAT;this._drapeSourceRenderer=this.view.basemapTerrain.overlayManager.registerDrapeSource(this,C,{...this._rendererParameters,dataType:e,samplingMode:t,pixelFormat:r,internalFormat:i}),this._material=new W({usesHalfFloats:a}),this._materialWithField=new W({usesHalfFloats:a,isAttributeDriven:!0}),this._filterVisibility=new M({context:{layerView:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this.updatingHandles.addOnCollectionChange((()=>this._loadedPointGraphics),(e=>this._onLoadedFeaturesChange(e)),h),this.updatingHandles.addWhen((()=>this._materialParameters),(e=>this._forEachMaterial((t=>t.setParameters(e)))),h),this.updatingHandles.add((()=>this._rendererParameters),(e=>this._drapeSourceRenderer.set(e))),this.updatingHandles.add((()=>this._heatmapRendererField),(()=>{this._recreate()}),c),this.updatingHandles.add((()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric})),(({fieldName:e,numeric:t})=>{if(n(e)&&t){let t=0;this._featureStore.forEach((r=>t+=r.attributes[e]??0)),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures}),h),this.handles.add([y((()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField})),(({fieldName:e,field:t})=>{e&&!t&&Y.warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)})),y((()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric})),(({field:e,numeric:t})=>{n(e)&&!t&&Y.warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)})),s((()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this)))])}destroy(){this._renderGeometries.clear(),this._material=l(this._material),this._materialWithField=l(this._materialWithField),this._featureStore.clear(),this._featureStore=null}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this.updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){const e=this.owner?.view?.resourceController?.memoryController?.memoryFactor??1,t=this.owner?.view?.qualitySettings,r=t?Math.ceil(t.heatmap.maxTotalNumberOfFeatures*e):0;return{minimumTotalNumberOfFeatures:0,maximumTotalNumberOfFeatures:r,maximumTotalNumberOfPrimitives:r*2,maximumNumberOfFeatures:r}}get hasZ(){return"hasZ"in this.layer&&this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;const{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:r}=this.view;return!B(r,e??0,t??0)}get usedMemory(){const e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=this._pixelFormat===$.RED?1:4,r=this._dataType===z.FLOAT?4:2,i=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return i*i*t*r+e}get usedMemoryPerFeature(){const e=this._loadedPointGraphics.find((()=>!0));if(p(e))return 0;const a=t(e),s=i(),o=6;return o*r([0,0,0],s)+o*r([0,0],s)+(this._heatmapRendererFieldIsNumeric?o*s:0)+a}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return{core:{visible:this._visibleFeatures,missing:0,pending:0},elevationUpdating:!1,visibilityFrustum:!0,visibilityScale:!0}}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return d(this._overlayRenderer.spatialReference)}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const e=this._heatmapRenderer;if(p(e))return null;const{minDensity:t,maxDensity:r}=e;return{minDensity:t,maxDensity:r,fieldTotal:this._fieldTotal}}get _radiusParameter(){return m(this._heatmapRenderer,(({radius:e})=>({searchRadius:_(this._clampSearchRadius(e))})))}get _resolutionForScaleParameter(){return m(this._heatmapRenderer,(({referenceScale:e})=>({resolutionForScale:0===e?0:v(e,this.view.spatialReference)})))}get _colorRampParameter(){return m(this._heatmapRenderer,(e=>({colorRampData:x(e.colorStops)})))}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){const e=this.owner?.view?.resourceController?.memoryController?.memoryFactor??1;return(this.owner?.view?.qualitySettings.heatmap.pixelRatio??1)*Math.sqrt(e)}get _renderView(){return this.view._stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===e?.type?e:null}get _heatmapRendererFieldName(){return m(this._heatmapRenderer,(e=>e.field))}get _heatmapRendererField(){return m(this._heatmapRendererFieldName,(e=>this.layer.fieldsIndex.get(e)))}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return!p(e)&&V(e)}get _isScaleRangeActive(){const{layer:e}=this;if(!("effectiveScaleRange"in e))return!1;const{minScale:t,maxScale:r}=e.effectiveScaleRange;return Z(t,r)}get _visibleFeatures(){let e=0;return this._renderGeometries.forEach((t=>{t.visible&&++e})),e}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlight(){return Q}maskOccludee(){return Q}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:t}=this.layer;this._featureStore.removeManyById(e.removed.map((e=>S(e,t)))),this._featureStore.addMany(e.added.map((e=>{const r=new P(w(new j,e.geometry),e.attributes,m(e.centroid,(e=>w(new j,e))),S(e,t));return r.displayId=e.uid,r})));const r=e.added,i=e.removed;this._fieldTotal+=this._computeFieldTotalChange(r,i);const a=u(i,(({uid:e})=>{const t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t})),s=r.map((e=>{const t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t}));a.length>0&&this._drapeSourceRenderer.removeGeometries(a,U.REMOVE),s.length>0&&this._drapeSourceRenderer.addGeometries(s,U.ADD),(s.length>0||a.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const t=this._heatmapRendererFieldName,r=n(t)?this._materialWithField:this._material,i=b();R(e.geometry,i,this._overlaySpatialReference),i[2]=I;const a=[[L.POSITION,new N(i,i.length)]],s=this._heatmapRendererFieldIsNumeric;n(t)&&a.push([L.FEATUREATTRIBUTE,new N([s?e.attributes[t]??0:0],1)]);const o=new D(new E(r,a,null,null,A.Point),{layerUid:this.layer.uid,graphicUid:e.uid});return F(o.boundingSphere,i),o.visible=this.filterVisibility.defaultVisibility,o}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(p(this._heatmapRendererFieldName)||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;const r=this._heatmapRendererFieldName,i=(e,t)=>e+(t.attributes[r]??0);return e.reduce(i,0)-t.reduce(i,0)}_clampSearchRadius(e){return e>J&&Y.warnOnce(`SceneView supports a maximum radius of ${J} pt for HeatmapRenderer.`),Math.min(e,J)}_updateFeatureVisibilities(e){const t=[];this._featureStore.forEach((({objectId:r,displayId:i})=>{const a=e(r),s=this._renderGeometries.get(i);s&&s.visible!==a&&(t.push(s),s.visible=a)})),this._drapeSourceRenderer.modifyGeometries(t,H.VISIBILITY)}_setAllFeaturesVisibility(e){const t=[];for(const r of this._renderGeometries.values())r.visible!==e&&(t.push(r),r.visible=e);this._drapeSourceRenderer.modifyGeometries(t,H.VISIBILITY)}get test(){return{visibleFeatureCount:this._visibleFeatures}}};e([f()],K.prototype,"type",void 0),e([f({constructOnly:!0})],K.prototype,"owner",void 0),e([f()],K.prototype,"layer",null),e([f()],K.prototype,"featureStore",null),e([f()],K.prototype,"updating",null),e([f()],K.prototype,"updatingRemaining",null),e([f()],K.prototype,"suspendInfo",null),e([f()],K.prototype,"legendEnabled",null),e([f()],K.prototype,"filterVisibility",null),e([f()],K.prototype,"displayFeatureLimit",null),e([f()],K.prototype,"preferredUpdatePolicy",void 0),e([f()],K.prototype,"hasZ",null),e([f()],K.prototype,"hasM",null),e([f()],K.prototype,"dataExtent",void 0),e([f()],K.prototype,"view",null),e([f()],K.prototype,"fullOpacity",null),e([f()],K.prototype,"updatePolicy",null),e([f()],K.prototype,"drapeSourceType",void 0),e([f()],K.prototype,"scaleVisibilitySuspended",null),e([f()],K.prototype,"renderer",null),e([f()],K.prototype,"_featureStore",void 0),e([f()],K.prototype,"_filterVisibility",void 0),e([f()],K.prototype,"_overlayRenderer",null),e([f()],K.prototype,"_overlaySpatialReference",null),e([f()],K.prototype,"_rendererParameters",null),e([f()],K.prototype,"_materialParameters",null),e([f()],K.prototype,"_densityParameters",null),e([f()],K.prototype,"_radiusParameter",null),e([f()],K.prototype,"_resolutionForScaleParameter",null),e([f()],K.prototype,"_colorRampParameter",null),e([f()],K.prototype,"_pixelRatioParameter",null),e([f()],K.prototype,"_densityMapPixelRatio",null),e([f()],K.prototype,"_renderGeometries",void 0),e([f()],K.prototype,"_material",void 0),e([f()],K.prototype,"_materialWithField",void 0),e([f()],K.prototype,"_renderView",null),e([f()],K.prototype,"_featuresArePoints",null),e([f()],K.prototype,"_loadedPointGraphics",null),e([f()],K.prototype,"_heatmapRenderer",null),e([f()],K.prototype,"_heatmapRendererFieldName",null),e([f()],K.prototype,"_heatmapRendererField",null),e([f()],K.prototype,"_heatmapRendererFieldIsNumeric",null),e([f()],K.prototype,"_fieldTotal",void 0),e([f()],K.prototype,"_drapeSourceRenderer",void 0),e([f()],K.prototype,"_isScaleRangeActive",null),K=e([g(q)],K);const Q=s();export{K as HeatmapFeatureProcessor,J as MAX_RADIUS_PT};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import o from"../../../../core/Evented.js";import r from"../../../../core/Handles.js";import s from"../../../../core/Logger.js";import{unwrapOr as n,isNone as i,isSome as a}from"../../../../core/maybe.js";import{getMetersPerVerticalUnitForSR as c}from"../../../../core/unitUtils.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as m}from"../../../../chunks/vec3.js";import{c as p}from"../../../../chunks/vec3f64.js";import{empty as h,toRect as u,expandWithVec3 as f}from"../../../../geometry/support/aaBoundingBox.js";import{empty as _}from"../../../../geometry/support/aaBoundingRect.js";import{getMetersPerUnit as y}from"../../../../symbols/support/unitConversionUtils.js";import{newIntersector as j}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as g}from"../../webgl-engine/lib/IntersectorInterfaces.js";const v=1;let b=class extends(o.EventedMixin(t)){get spatialReference(){return this.view?.spatialReference}constructor(e){super(e),this._elevationOffset=0,this._layerHandes=new r}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._intersectLayers=[this.stageLayer],this._intersector=j(this.view.state.viewingMode),this._intersector.options.store=g.MIN;const e=this._computeLayerExtent(this.spatialReference,this.stageLayer);this._zmin=e[2],this._zmax=e[5];const t=this.stageLayer.events;this._layerHandes.add([t.on("layerObjectAdded",(e=>this._objectChanged(e.object))),t.on("layerObjectRemoved",(e=>this._objectChanged(e.object))),t.on("objectGeometryAdded",(e=>this._objectChanged(e.object))),t.on("objectGeometryRemoved",(e=>this._objectChanged(e.object))),t.on("objectGeometryUpdated",(e=>this._objectChanged(e.object))),t.on("objectTransformation",(e=>this._objectChanged(e)))])}dispose(){this._layerHandes.destroy()}elevationInfoChanged(){const e=null!=this.layer?this.layer.elevationInfo:null;if(null!=e&&"on-the-ground"!==e.mode){const t=c(this.layer.spatialReference),o=y(e.unit);this._elevationOffset=n(e.offset,0)*o/t}else this._elevationOffset=0}getElevation(e,t,o,r){if(R[0]=e,R[1]=t,R[2]=o,!this._renderCoordsHelper.toRenderCoords(R,r,R))return s.getLogger(this.declaredClass).error("could not project point for elevation alignment"),null;const n=this._elevationOffset,i=this._zmin+n,a=this._zmax+n;this._renderCoordsHelper.setAltitude(H,a,R),this._renderCoordsHelper.setAltitude(L,i,R);const c=e
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import o from"../../../../core/Evented.js";import r from"../../../../core/Handles.js";import s from"../../../../core/Logger.js";import{unwrapOr as n,isNone as i,isSome as a}from"../../../../core/maybe.js";import{getMetersPerVerticalUnitForSR as c}from"../../../../core/unitUtils.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as m}from"../../../../chunks/vec3.js";import{c as p}from"../../../../chunks/vec3f64.js";import{empty as h,toRect as u,expandWithVec3 as f}from"../../../../geometry/support/aaBoundingBox.js";import{empty as _}from"../../../../geometry/support/aaBoundingRect.js";import{getMetersPerUnit as y}from"../../../../symbols/support/unitConversionUtils.js";import{newIntersector as j}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as g}from"../../webgl-engine/lib/IntersectorInterfaces.js";const v=1;let b=class extends(o.EventedMixin(t)){get spatialReference(){return this.view?.spatialReference}constructor(e){super(e),this._elevationOffset=0,this._layerHandes=new r}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._intersectLayers=[this.stageLayer],this._intersector=j(this.view.state.viewingMode),this._intersector.options.store=g.MIN;const e=this._computeLayerExtent(this.spatialReference,this.stageLayer);this._zmin=e[2],this._zmax=e[5];const t=this.stageLayer.events;this._layerHandes.add([t.on("layerObjectAdded",(e=>this._objectChanged(e.object))),t.on("layerObjectRemoved",(e=>this._objectChanged(e.object))),t.on("objectGeometryAdded",(e=>this._objectChanged(e.object))),t.on("objectGeometryRemoved",(e=>this._objectChanged(e.object))),t.on("objectGeometryUpdated",(e=>this._objectChanged(e.object))),t.on("objectTransformation",(e=>this._objectChanged(e)))])}dispose(){this._layerHandes.destroy()}elevationInfoChanged(){const e=null!=this.layer?this.layer.elevationInfo:null;if(null!=e&&"on-the-ground"!==e.mode){const t=c(this.layer.spatialReference),o=y(e.unit??"meters");this._elevationOffset=n(e.offset,0)*o/t}else this._elevationOffset=0}getElevation(e,t,o,r){if(R[0]=e,R[1]=t,R[2]=o,!this._renderCoordsHelper.toRenderCoords(R,r,R))return s.getLogger(this.declaredClass).error("could not project point for elevation alignment"),null;const n=this._elevationOffset,i=this._zmin+n,a=this._zmax+n;this._renderCoordsHelper.setAltitude(H,a,R),this._renderCoordsHelper.setAltitude(L,i,R);const c=e=>!!e.metadata?.isElevationSource;return this._intersector.reset(H,L,null),this._intersector.intersect(this._intersectLayers,null,v,null,c),this._intersector.results.min.getIntersectionPoint(R)?this._renderCoordsHelper.getAltitude(R):null}_objectChanged(e){const t=this.spatialReference;if(!e.metadata?.isElevationSource||i(t))return;h(x);const o=e.metadata.lastValidElevationBB;o.isEmpty()||this._expandExtent(t,o.min,o.max,x);const{min:r,max:s}=e.boundingVolumeWorldSpace;this._expandExtent(t,r,s,x),u(x,C),this._zmin=Math.min(this._zmin,x[2]),this._zmax=Math.max(this._zmax,x[5]),E.extent=C,E.spatialReference=t,this.emit("elevation-change",E),m(o.min,r),m(o.max,s)}_computeLayerExtent(e,t){return h(x),a(e)&&t.objects.forAll((t=>this._expandExtent(e,t.boundingVolumeWorldSpace.min,t.boundingVolumeWorldSpace.max,x))),x}_expandExtent(e,t,o,r){for(let s=0;s<8;++s)R[0]=1&s?t[0]:o[0],R[1]=2&s?t[1]:o[1],R[2]=4&s?t[2]:o[2],this._renderCoordsHelper.fromRenderCoords(R,R,e),f(r,R);return r}};e([l({constructOnly:!0})],b.prototype,"layer",void 0),e([l({constructOnly:!0})],b.prototype,"stageLayer",void 0),e([l({constructOnly:!0})],b.prototype,"view",void 0),e([l()],b.prototype,"spatialReference",null),b=e([d("esri.views.3d.layers.support.StageLayerElevationProvider")],b);const x=h(),C=_(),E={spatialReference:null,extent:C,context:"scene"},R=p(),H=p(),L=p();export{b as StageLayerElevationProvider};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{isSome as t,isNone as s,destroyMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as u,createAbortError as a}from"../../../../core/promiseUtils.js";import{property as y}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromFeatureSetJSON as n}from"../../../../layers/graphics/dehydratedFeatures.js";import{runQuery as p,executeQuery as c}from"../../../../rest/query/operations/query.js";import{PBFDecoder as l}from"../../support/PBFDecoder.js";let d=class extends r{constructor(e){super(e)}get queryFeaturesDehydrated(){const e=this.layer.capabilities,r=e&&e.query
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{isSome as t,isNone as s,destroyMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as u,createAbortError as a}from"../../../../core/promiseUtils.js";import{property as y}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromFeatureSetJSON as n}from"../../../../layers/graphics/dehydratedFeatures.js";import{runQuery as p,executeQuery as c}from"../../../../rest/query/operations/query.js";import{PBFDecoder as l}from"../../support/PBFDecoder.js";let d=class extends r{constructor(e){super(e)}get queryFeaturesDehydrated(){const e=this.layer.capabilities,r=e&&e.query,o=r&&r.supportsFormatPBF,y=this.layer.parsedUrl;if(o){s(this._decoder)&&(this._decoder=new l(this.controller));const e={sourceSpatialReference:this.layer.spatialReference?.toJSON()??null,applyTransform:!0,maxStringAttributeLength:1024};return(r,s)=>p(y,r,"pbf",this._createRequestOptions(s)).then((r=>(u(s),t(this._decoder)?this._decoder.invoke({buffer:r.data,options:e},s.signal):Promise.reject(a()))))}return(e,r)=>c(y,e,this.layer.spatialReference,this._createRequestOptions(r)).then((e=>n(e.data)))}queryFeatureCount(e,r){return this.layer.queryFeatureCount(e,r)}destroy(){this._decoder=o(this._decoder)}_createRequestOptions(e){return{...e,query:{...this.layer.customParameters,token:this.layer.apiKey,...e?.query}}}};e([y({constructOnly:!0})],d.prototype,"layer",void 0),e([y({constructOnly:!0})],d.prototype,"controller",void 0),e([y({readOnly:!0})],d.prototype,"queryFeaturesDehydrated",null),d=e([i("esri.views.3d.layers.support.featureTileQuery3D.FeatureTileServiceQuery3D")],d);let h=class extends r{constructor(e){super(e)}queryFeaturesDehydrated(e,r){return this.layer.queryFeatures(e,r)}queryFeatureCount(e,r){return this.layer.queryFeatureCount(e,r)}};e([y({constructOnly:!0})],h.prototype,"layer",void 0),e([y({readOnly:!0})],h.prototype,"queryFeaturesDehydrated",null),h=e([i("esri.views.3d.layers.support.featureTileQuery3D.FeatureTileServiceMeshQuery3D")],h);let m=class extends r{constructor(e){super(e)}queryFeaturesDehydrated(e,r){return this.layer.queryFeatures(e,r)}};e([y({constructOnly:!0})],m.prototype,"layer",void 0),m=e([i("esri.views.3d.layers.support.featureTileQuery3D.FeatureTileServiceQuery3D")],m);let f=class extends r{constructor(e){super(e)}queryFeaturesDehydrated(e,r){return this.source.queryFeaturesJSON(e,r).then(n,(t=>{if(t&&"query-features-json:unsupported"===t.name)return this.layer.queryFeatures(e,r);throw t}))}queryFeatureCount(e,r){return this.layer.queryFeatureCount(e,r)}};function q(e,r){return"feature"===e.type&&"feature-layer"===e.source.type?t(e.infoFor3D)?new h({layer:e}):new d({layer:e,controller:r}):"feature"===e.type&&"memory"===e.source.type||"csv"===e.type||"geojson"===e.type||"oriented-imagery"===e.type||"wfs"===e.type?new f({layer:e,source:e.source}):"ogc-feature"===e.type?new m({layer:e}):null}e([y({constructOnly:!0})],f.prototype,"layer",void 0),e([y({constructOnly:!0})],f.prototype,"source",void 0),f=e([i("esri.views.3d.layers.support.featureTileQuery3D.FeatureTileClientQuery3D")],f);export{q as createFeatureTileQuery3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as e,isNone as r}from"../../../../core/maybe.js";import{project as o}from"../../../../geometry/support/webMercatorUtils.js";import{projectGeometry as t}from"../../../../portal/support/geometryServiceUtils.js";function l(l){const s=l.view.spatialReference,i=l.layer.fullExtent,n=e(i)&&i.spatialReference;if(r(i)||!n)return Promise.resolve(null);if(n.equals(s))return Promise.resolve(i.clone());const a=o(i,s);return e(a)?Promise.resolve(a):l.view.state.isLocal?t(i,s,l.layer.portalItem).then((e=>!l.destroyed&&e?e:
|
|
5
|
+
import{isSome as e,isNone as r}from"../../../../core/maybe.js";import{project as o}from"../../../../geometry/support/webMercatorUtils.js";import{projectGeometry as t}from"../../../../portal/support/geometryServiceUtils.js";function l(l){const s=l.view.spatialReference,i=l.layer.fullExtent,n=e(i)&&i.spatialReference;if(r(i)||!n)return Promise.resolve(null);if(n.equals(s))return Promise.resolve(i.clone());const a=o(i,s);return e(a)?Promise.resolve(a):l.view.state.isLocal?t(i,s,l.layer.portalItem).then((e=>!l.destroyed&&e?e:null)).catch((()=>null)):Promise.resolve(null)}export{l as toViewIfLocal};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{DehydratedFeatureSetParserContext as e}from"../../../rest/query/operations/pbfDehydratedFeatureSet.js";import{parsePBFFeatureQuery as r}from"../../../rest/query/operations/pbfQueryUtils.js";class t{_parseFeatureQuery(t){const s=r(t.buffer,new e(t.options)),o={...s,spatialReference:s.spatialReference
|
|
5
|
+
import{DehydratedFeatureSetParserContext as e}from"../../../rest/query/operations/pbfDehydratedFeatureSet.js";import{parsePBFFeatureQuery as r}from"../../../rest/query/operations/pbfQueryUtils.js";class t{_parseFeatureQuery(t){const s=r(t.buffer,new e(t.options)),o={...s,spatialReference:s.spatialReference?.toJSON(),fields:s.fields?s.fields.map((e=>e.toJSON())):void 0};return Promise.resolve(o)}}function s(){return new t}export{s as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{removeUnordered as e}from"../../../core/arrayUtils.js";import t from"../../../core/Handles.js";import{makeHandle as s}from"../../../core/handleUtils.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{watch as i,sync as n}from"../../../core/reactiveUtils.js";import{getReferenceEllipsoid as c}from"../../../geometry/projectionEllipsoid.js";import{ObjectResourceCache as a}from"../layers/graphics/ObjectResourceCache.js";import{ClientType as o}from"./index.js";import{StreamTextureCollection as
|
|
5
|
+
import{removeUnordered as e}from"../../../core/arrayUtils.js";import t from"../../../core/Handles.js";import{makeHandle as s}from"../../../core/handleUtils.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{watch as i,sync as n}from"../../../core/reactiveUtils.js";import{getReferenceEllipsoid as c}from"../../../geometry/projectionEllipsoid.js";import{ObjectResourceCache as a}from"../layers/graphics/ObjectResourceCache.js";import{ClientType as o}from"./index.js";import{StreamTextureCollection as p}from"./StreamTextureCollection.js";import{getSettings as l,getLabelSettings as h}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{TextureWrapMode as S}from"../../webgl/enums.js";class u{constructor(e){this.textures=null,this.streamDataRequester=null,this._graphicsOwners=[],this._screenSizePerspectiveHandles=null,this.cimSymbolRasterizer=null,this._viewState=e.viewState,this._view=e.view,this._pointsOfInterest=e.pointsOfInterest,this.streamDataRequester=e.resourceController.createStreamDataRequester(o.SYMBOLOGY),this.objectResourceCache=new a(((t,s)=>e.resourceController.memoryController.newCache(t,s))),this.textures=new p(this.streamDataRequester,e.view._stage,{preMultiplyAlpha:!0,wrap:{s:S.CLAMP_TO_EDGE,t:S.CLAMP_TO_EDGE}},e.resourceController.scheduler);const t=c(this._view.spatialReference).radius;this.screenSizePerspectiveSettings=l(e.viewingMode,t),this.screenSizePerspectiveSettingsLabels=h(e.viewingMode,t)}destroy(){r(this.textures),this.textures=null,this.streamDataRequester=null}addGraphicsOwner(t){if(!t)return s();this._graphicsOwners.push(t);const r=i((()=>t.layer?.screenSizePerspectiveEnabled),(()=>this._updateScreenSizePerspectiveEnabled()));return this._updateScreenSizePerspectiveEnabled(),s((()=>{r.remove(),e(this._graphicsOwners,t),this._updateScreenSizePerspectiveEnabled()}))}_updateScreenSizePerspectiveEnabled(){const e=this._graphicsOwners.some((e=>!0===e.layer?.screenSizePerspectiveEnabled));if(e&&!this._screenSizePerspectiveHandles){this._screenSizePerspectiveHandles=new t;const e=()=>this._updateScreenSizePerspectiveSettings();this._screenSizePerspectiveHandles.add([i((()=>this._pointsOfInterest.centerOnSurfaceInfrequent.distance),e,n),this._viewState.events.on("camera-projection-changed",e)]),this._updateScreenSizePerspectiveSettings()}else e||(this._screenSizePerspectiveHandles=r(this._screenSizePerspectiveHandles))}_updateScreenSizePerspectiveSettings(){const e=this._pointsOfInterest;d.distance=e.centerOnSurfaceInfrequent.distance,d.fovY=this._viewState.camera.fovY,this.screenSizePerspectiveSettings.update(d),this.screenSizePerspectiveSettingsLabels.update(d),this._view._stage.renderView.requestRender()}get test(){return{screenSizePerspectiveHandles:this._screenSizePerspectiveHandles}}}const d={distance:0,fovY:0};export{u as SharedSymbolResources};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{equals as e}from"../../../core/arrayUtils.js";import{isPowerOfTwo as t}from"../../../core/mathUtils.js";import{isSome as r,isNone as i,mapOr as s}from"../../../core/maybe.js";import{i as a,j as o,u as n,b as l,n as h,e as d,w as g,F as c}from"../../../chunks/vec3.js";import{c as u,a as m}from"../../../chunks/vec3f64.js";import{empty as p}from"../../../geometry/support/aaBoundingBox.js";import{containsXY as f}from"../../../geometry/support/aaBoundingRect.js";import{earth as y}from"../../../geometry/support/Ellipsoid.js";import{glLayout as _}from"../support/buffer/glUtil.js";import{GeometryState as x}from"./GeometryState.js";import{NeighborIndex as v}from"./interfaces.js";import{LayerClass as C}from"./LayerClass.js";import{PatchGeometry as D,releaseGeometry as S}from"./PatchGeometry.js";import{ENABLE_TERRAIN_INTERNAL_CHECKS as $,internalAssert as E,neighborEdgeIndices as b,oppositeEdge as T,neighborCornerIndices as j,v32s as A,lij2s as V}from"./terrainUtils.js";import{TextureFader as R,ActivationTime as w}from"./TextureFader.js";export{ActivationTime}from"./TextureFader.js";import{isEdgeNeighbor as L}from"./Tile.js";import P from"./TileOverlayData.js";import{fallsWithinLayer as N}from"./tileUtils.js";import{VertexArrayObject as I}from"../webgl-engine/lib/VertexArrayObject.js";import{terrainVertexAttributeLocations as G}from"../webgl-engine/shaders/TerrainTechnique.js";import{BufferObject as M}from"../../webgl/BufferObject.js";class O{constructor(){this.geometryInfo=new D,this.intersectionData=null,this.geometryState=null,this._textureRef=new R((()=>this.tile.surface.textureFadeDuration)),this.overlay=new P,this._geometryStateChangedSinceLastUpdate=!0,this._hasGeometry=!1,this._numVerticesPerSideChanged=!1,this._samplerDataChanged=!1,this._clippingAreaChanged=!1,this._wireframeChanged=!1,this._shadingChanged=!1,this._dirtyEdgeResolutions=15,this._dirtyEdges=15,this._dirtyCorners=15}get tile(){return this._tile}init(e){this.clear(),this._tile=e;const t=this.geometryInfo;t.indices=null,t.vertexAttributes=null,p(t.boundingBox),t.indexCount=0,t.numVerticesPerSide=0,this.intersectionData=null,this.geometryState=new x,this.localOrigin=null,this.overlay.clear()}clear(){this.releaseGeometry(),this.releaseTexture(),this._textureRef.clear(),this._tile=null,this.intersectionData=null,this.geometryState=null}updateGeometryIfNeeded(e){if((!this._vao||this._geometryStateChangedSinceLastUpdate||this._wireframeChanged||this._shadingChanged||this._clippingAreaChanged||this._samplerDataChanged||this._numVerticesPerSideChanged||this._dirtyCorners||this._dirtyEdgeResolutions||this._dirtyEdges)&&(this._updateGeometry(e),this._geometryStateChangedSinceLastUpdate=!1),$&&this.tile.intersectsClippingArea)for(let t=0;t<4;++t)E(this.geometryInfo.outerEdges[t].count===this.geometryState.neighborData.edgeResolutions[t]+1)}_calculateEdgeResolution(e,t){const s=this.tile,a=this.geometryState.numVerticesPerSide-1;if(!s.surface.isGlobal){const t=s.surface.extent;if(r(t)&&(0===e&&s.extent[3]>t[3]||1===e&&s.extent[2]>t[2]||2===e&&s.extent[1]<t[1]||3===e&&s.extent[0]<t[0]))return a}const o=s.level,n=b[e];if(!t)return E(i(s.surface?.rootTiles)||s.surface.updatingRootTiles||!s.shouldHaveNeighbor(n)),a;if(t.isLoaded){const r=t,i=r.renderData.geometryState,s=o-r.level;if(E(s>=0),0===s){const e=i.numVerticesPerSide-1;return Math.max(e,a)}const n=2**s,l=i.neighborData.edgeResolutions[(e+2)%4]/n;return Math.max(1,l)}E(!t.isLeaf);let l=a;return t.forAllSubtreeOnSide(T(n),(e=>e===s||(e.isLoaded?(l=Math.max(l,2**(e.level-o)),!0):(E(!e.isLeaf),!1)))),l}updateNeighborData(){const e=this.tile;if(!e.intersectsClippingArea)return;const r=e.renderData.geometryState.neighborData,i=t=>(t.isLoaded||t.level===e.level)&&t?.intersectsClippingArea,s=r.edgePeerNeighbors,a=r.edgePeerNeighborSamplerVersions;for(let n=0;n<4;++n){const o=e.findNeighborTile(b[n],i),l=z(e,o),h=l?.renderData?.geometryState.samplerDataVersion??-1,d=s[n],g=l!==z(e,d),c=a[n]!==h;s[n]=o,(g||c)&&(a[n]=h,this._markEdgeDirty(n));const u=r.edgeResolutions[n],m=this._calculateEdgeResolution(n,o);E(t(m)),E(m>=1),r.edgeResolutions[n]=m,u!==m&&this._markEdgeResolutionDirty(n)}const o=r.cornerPeerNeighbors;for(let t=0;t<4;++t){const a=e.findNeighborTile(j[t],i);o[t]=a;const n=z(e,s[t]),l=z(e,s[(t+1)%4]),h=z(e,a);q[t]=h,q[(t+1)%4]=l,q[(t+2)%4]=e,q[(t+3)%4]=n,E(q.some((t=>t?.isLoaded||t===e)));const d=q.reduce(((e,t)=>Math.min(e,t?.level??1/0)),1/0);q.forEach(((e,t)=>{e&&e?.level>d&&(q[t]=null)})),E(q.some((t=>t?.isLoaded||t===e)));const g=r.cornerNeighborData[t].cornerTiles,c=r.cornerNeighborData[t].cornerTileSamplerVersions;for(let e=0;e<4;++e){const r=q[e],i=r?.renderData.geometryState.samplerDataVersion??-1,s=g[e]!==r,a=!s&&c[e]!==i;(s||a)&&(g[e]=r,c[e]=i,this._markCornerDirty(t))}E(g.some((t=>t?.isLoaded||t===e)))}$&&E(this.geometryState.neighborData.edgeResolutions.every((e=>e>0)));for(let t=0;t<4;++t)q[t]=null}_updateGeometry(e){if(!this.tile.intersectsClippingArea)return;$&&E(!this.tile.intersectsClippingArea||this.geometryState.neighborData.edgeResolutions.every((e=>e>0))),this.intersectionData=null;const t=this.tile,r=this._vao,i=this.geometryInfo.vertexAttributes,s=!r||!i||this._wireframeChanged||this._shadingChanged||this._numVerticesPerSideChanged||this._samplerDataChanged||this._clippingAreaChanged||this._dirtyEdgeResolutions,a=!s&&(0!==this._dirtyEdges||0!==this._dirtyEdgeResolutions),o=!a&&0!==this._dirtyCorners;s?(this.releaseGeometry(),this._createGeometry(e)):a||o?t.updateEdgeElevations():o?t.updateCornerElevations():console.warn("Update for no reason?"),this._numVerticesPerSideChanged=!1,this._samplerDataChanged=!1,this._dirtyEdgeResolutions=0,this._dirtyEdges=0,this._dirtyCorners=0,this._clippingAreaChanged=!1,this._wireframeChanged=!1,this._shadingChanged=!1}get hasGeometry(){return this._hasGeometry}releaseGeometry(){return this._hasGeometry=!1,this.intersectionData=null,!!this._vao&&(this._vao.dispose(),this._vao=null,S(this.geometryInfo),!0)}ensureTexture(e,t){return r(this._texture)&&this._texture.descriptor.width!==e&&this.releaseTexture(),i(this._texture)&&(this._texture=t(),this.tile.setMemoryDirty()),this._texture}releaseTexture(){r(this._texture)&&(this._texture.release(),this._texture=null,this.tile.setMemoryDirty())}_markCornerDirty(e){const t=1<<e;this._dirtyCorners|=t}_markEdgeDirty(e){const t=1<<e;this._dirtyEdges|=t}_markEdgeResolutionDirty(e){const t=1<<e;this._dirtyEdgeResolutions|=t,this._dirtyEdges|=t}_markAllEdgesAndCornersDirty(){this._dirtyCorners=15,this._dirtyEdges=15,this._dirtyEdgeResolutions=15}updateGeometryState(){const t=this._getElevationInfo(),r=this.tile,i=t.samplerData?r.getElevationBasedVerticesPerSide(t.maxTileLevel):r.getDefaultVerticesPerRowOnLevel(),s=Math.max(i,5);let a=r.clippingArea;r.intersectsClippingArea&&!r.isWithinClippingArea||(a=null);const o=this.geometryState;let n=!1;o.numVerticesPerSide!==s&&(this._numVerticesPerSideChanged=!0,o.numVerticesPerSide=s,o.samplerDataVersion++,n=!0),t.changed&&(this._samplerDataChanged=!0,o.samplerData=t.samplerData,o.samplerDataVersion++,n=!0),e(o.clippingArea,a)||(this._clippingAreaChanged=!0,o.clippingArea=a,n=!0);const l=r.surface,h=l.wireframe;o.wireframe!==h&&(this._wireframeChanged=!0,o.wireframe=h,n=!0);const d=l.shading;return o.shading!==d&&(this._shadingChanged=d,o.shading=d,n=d),this._geometryStateChangedSinceLastUpdate||(this._geometryStateChangedSinceLastUpdate=n),n&&this._markAllEdgesAndCornersDirty(),this._hasGeometry=!0,this._geometryStateChangedSinceLastUpdate}_createGeometry(e){this.tile.createGeometry();const t=this.geometryInfo.vertexAttributes,r=this.geometryInfo.indices,i=e.gl;this._vao=new I(e,G,{geometry:_(t.layout)},{geometry:M.createVertex(e,i.STATIC_DRAW,t.buffer)},M.createIndex(e,i.STATIC_DRAW,r)),this._hasGeometry=!0}get vao(){return this._vao}setTextureReference(e,t=w.Immediate){r(e)&&e.texture!==this._texture&&this.releaseTexture(),this._textureRef.push(e,t)}get textureReference(){return this._textureRef.current}get nextTextureReference(){return this._textureRef.next}get textureFadeFactor(){return this._textureRef.fadeFactor}get textureIsFading(){return this._textureRef.isFading}_getElevationInfo(){const e=this.geometryState.samplerData,t=this.tile.layerInfo[C.ELEVATION],i=t.length,s=new Array(i);let a=0,o=0,n=!1;for(let d=0;d<i;d++){const i=t[d];if(r(i.upsampleInfo)){const t=i.upsampleInfo.tile,r=t.layerInfo[C.ELEVATION][d].data,l=r&&r.samplerData;e&&e[a]===l||(n=!0),s[a++]=l,o=Math.max(o,t.lij[0])}else if(i.data){const t=this.tile.surface.layerViewByIndex(d,C.ELEVATION);if(N(this.tile,t.layer,!1)){const t=i.data;e&&e[a]===t.samplerData||(n=!0),s[a++]=t.samplerData,o=this.tile.level}}}r(e)&&e.length!==a&&(n=!0);const l=a>0,h=l?s:null;return l&&(s.length=a),{changed:n,samplerData:h,maxTileLevel:o}}get estimatedGeometryMemoryUsage(){const e=s(this.intersectionData,0,(e=>e.estimatedMemoryUsage));return(this.geometryInfo.indices?.byteLength??0)+(this.geometryInfo.vertexAttributes?.byteLength??0)+e}get textureDescriptor(){return r(this._texture)?this._texture.descriptor:null}get test(){return{hasTexture:null!=this._texture}}checkGeometryWaterproofness(){if(!$)return;const e=this.tile;if(E(e?.isLoaded),!e.isLoaded||!e.intersectsClippingArea)return;const s=e.renderData;if(0===e.level)return;const p=e.surface.extent;if(r(p)&&!e.intersectsExtent(p))return;const _=b.map(((t,i)=>!!r(p)&&(i<2?-1:1)*(e.extent[3-i]-p[3-i])<0)),x=e.level;E(0===this._dirtyCorners),E(0===this._dirtyEdges),E(0===this._dirtyEdgeResolutions),E(!this._numVerticesPerSideChanged),E(!this._samplerDataChanged),E(!this._clippingAreaChanged),E(!this._wireframeChanged);const C=j.map((t=>e.findNeighborCornerTileExact(t,(t=>!t.intersectsClippingArea||t.isLoaded||t.level===e.level))??null)).map((e=>e?.intersectsClippingArea?e:null)),D=this.geometryState.neighborData;for(let t=0;t<4;++t){const r=D.cornerPeerNeighbors[t],i=C[t];E(i===r,`Tile[${e.lij}].corner[${t}] out of date: cur=[${r?.lij}] exp=[${i?.lij}]`)}b.forEach(((p,C)=>{if(_[C])return;const D=e.findNeighborTile(p,(e=>(e.level===x||e?.isLoaded)&&e?.intersectsClippingArea));if(!D){const t=!e.surface.updatingRootTiles&&r(e.surface.rootTiles)&&e.surface.rootTiles.length>0&&e.shouldHaveNeighbor(p);return void E(!t)}E(D.isLoaded||D.level===e.level),E(D===this.geometryState.neighborData.edgePeerNeighbors[C]);const S=x-D.level;if(!D.isLoaded)return E(!D.isLeaf),void E(0===S);const $=D.renderData;E(L(e,D,p)),E(S>=0);const b=2**S;if(S<0)return void E(!1);const T=s.geometryInfo,j=T.outerEdges[C],R=T.numVerticesPerSide-1,w=$.geometryInfo;if(!w)return void E(!1);{const e=this.geometryState.neighborData.edgePeerNeighbors[C];if(e?.isLoaded){const t=e.renderData;E(e==e),E(s.geometryState.neighborData.edgePeerNeighborSamplerVersions[C]===t.geometryState.samplerDataVersion),E(this.geometryState.neighborData.edgePeerNeighborSamplerVersions[C]===t.geometryState.samplerDataVersion)}}const P=(C+2)%4,N=w.outerEdges[P],I=j.count-1,G=N.count-1;E(I*b===G,`Tile[${e.lij}]:e${C},res=${I} edgeRes mismatch with Neighbor[${D.lij}]:e${P},res=${G} (expected:${I*b})`);const M=e.extent,O=p===v.NORTH||p===v.SOUTH,q=N.count-1,z=q/2**S,J=j.count-1;if(z<1)return void E(1===J);E(z===J),E(t(z));const K=w.numVerticesPerSide-1;E(S>0||z===Math.max(K,R));const Q=e.getNeighborEdgeStartVertexIndex(C,D);E(0<=Q&&Q<b);const Y=Q*z;E(0<=Y&&Y<=q-z);let Z=0,ee=Y;j.getVertexPos(U,0),j.getVertexPos(k,j.count-1);const te=a(U,k),re=Math.max(W,1e-4*te);for(let t=0;t<=z;++t){j.getVertexPos(U,Z),N.getVertexPos(k,ee);const a=t/z,_=O?M[0]+a*(M[2]-M[0]):p===v.WEST?M[0]:M[2],x=O?p===v.SOUTH?M[1]:M[3]:M[1]+a*(M[3]-M[1]),S=e.surface.extent;if(i(S)||f(S,_,x)){const t=o(U,k),i=n(U)-y.radius,a=n(k)-y.radius,p=t<re;if(!p){console.warn(`Tile edge vertex position mismatch: between [${e.lij}].edge${C}[${Z}/${j.count}] and [${D.lij}].edge${P}[${ee}/${N.count}]`),r(S)&&console.warn(" surface extent= ",S," x,y=",_,",",x);const o=u();l(o,s.localOrigin,$.localOrigin),n(o)>0&&console.warn(` localOrigins: ${s.localOrigin} vs ${$.localOrigin} d=${n(o)} [${o}]`);(()=>{const t=m(U),r=m(k);e.updateEdgeElevations(),D.updateEdgeElevations(),j.getVertexPos(U,Z),N.getVertexPos(k,ee);const i=u();g(i,U,t),n(i)>0&&console.warn(` XXX Tile[${e.lij}] edge out of date: ${t} vs ${U} d=${n(i)} [${i}]`),g(i,k,r),n(i)>0&&console.warn(` XXX Neighbor[${D.lij}] edge out of date: ${r} vs ${k} d=${n(i)} [${i}]`)})(),E(p,`Mismatch in tile [${e.lij}].edge[${C}][${Z}/${j.count}] vs neighbor [${D.lij}].edge[${P}][${ee}/${N.count}] ${A(U)} vs ${A(k)} dist=${t} h(t|n|d)=${i}|${a}|${a-i}`)}if(e.surface.shading){j.getNormal(F,Z),N.getNormal(B,ee),h(X,F),h(H,B);const t=d(X,H),r=1-t<.01||!1||e===D;if(!r){const i=u();g(i,F,B);const s=()=>`Mismatch in tile edge normal ${V(e.lij)} (${Z}/${j.count-1}) edge ${C} vs neighbor ${V(D.lij)} (${ee}/${N.count-1}) nedge ${P} :${A(F)} vs ${A(B)} dot = ${t} : ${A(i)}`;console.warn("Mismatch in tile edge normal: ",s());{e.updateEdgeElevations(),D.updateEdgeElevations();const t=u(),r=u();j.getNormal(t,Z),N.getNormal(r,ee),c(F,t)||console.warn("Missing update in tile normal: ",A(F)," => ",A(t)),c(B,r)||console.warn("Missing update in neighbor normal: ",A(B)," => ",A(r))}E(r,s())}}}Z+=1,ee+=1}}))}}const U=u(),k=u(),F=u(),B=u(),X=u(),H=u(),W=1,q=[null,null,null,null];function z(e,t){return t?.isLoaded||t===e?t:null}export{O as PatchRenderData,z as neighborTileIfLoadedOrSelf};
|
|
5
|
+
import{equals as e}from"../../../core/arrayUtils.js";import{isPowerOfTwo as t}from"../../../core/mathUtils.js";import{isSome as r,isNone as i,mapOr as s}from"../../../core/maybe.js";import{i as a,j as n,u as o,b as l,n as h,e as d,w as g,F as c}from"../../../chunks/vec3.js";import{c as u,a as m}from"../../../chunks/vec3f64.js";import{empty as p}from"../../../geometry/support/aaBoundingBox.js";import{containsXY as f}from"../../../geometry/support/aaBoundingRect.js";import{earth as y}from"../../../geometry/support/Ellipsoid.js";import{glLayout as _}from"../support/buffer/glUtil.js";import{GeometryState as x}from"./GeometryState.js";import{NeighborIndex as C}from"./interfaces.js";import{LayerClass as v}from"./LayerClass.js";import{PatchGeometry as D,releaseGeometry as S}from"./PatchGeometry.js";import{ENABLE_TERRAIN_INTERNAL_CHECKS as $,internalAssert as E,neighborEdgeIndices as b,oppositeEdge as T,neighborCornerIndices as j,v32s as A,lij2s as V}from"./terrainUtils.js";import{TextureFader as R,ActivationTime as w}from"./TextureFader.js";import{isEdgeNeighbor as L}from"./Tile.js";import P from"./TileOverlayData.js";import{fallsWithinLayer as N}from"./tileUtils.js";import{VertexArrayObject as I}from"../webgl-engine/lib/VertexArrayObject.js";import{terrainVertexAttributeLocations as G}from"../webgl-engine/shaders/TerrainTechnique.js";import{BufferObject as M}from"../../webgl/BufferObject.js";class O{constructor(){this.geometryInfo=new D,this.intersectionData=null,this.geometryState=null,this._textureRef=new R((()=>this.tile.surface.textureFadeDuration)),this.overlay=new P,this._geometryStateChangedSinceLastUpdate=!0,this._hasGeometry=!1,this._numVerticesPerSideChanged=!1,this._samplerDataChanged=!1,this._clippingAreaChanged=!1,this._wireframeChanged=!1,this._shadingChanged=!1,this._dirtyEdgeResolutions=15,this._dirtyEdges=15,this._dirtyCorners=15}get tile(){return this._tile}init(e){this.clear(),this._tile=e;const t=this.geometryInfo;t.indices=null,t.vertexAttributes=null,p(t.boundingBox),t.indexCount=0,t.numVerticesPerSide=0,this.intersectionData=null,this.geometryState=new x,this.localOrigin=null,this.overlay.clear()}clear(){this.releaseGeometry(),this.releaseTexture(),this._textureRef.clear(),this._tile=null,this.intersectionData=null,this.geometryState=null}updateGeometryIfNeeded(e){if((!this._vao||this._geometryStateChangedSinceLastUpdate||this._wireframeChanged||this._shadingChanged||this._clippingAreaChanged||this._samplerDataChanged||this._numVerticesPerSideChanged||this._dirtyCorners||this._dirtyEdgeResolutions||this._dirtyEdges)&&(this._updateGeometry(e),this._geometryStateChangedSinceLastUpdate=!1),$&&this.tile.intersectsClippingArea)for(let t=0;t<4;++t)E(this.geometryInfo.outerEdges[t].count===this.geometryState.neighborData.edgeResolutions[t]+1)}_calculateEdgeResolution(e,t){const s=this.tile,a=this.geometryState.numVerticesPerSide-1;if(!s.surface.isGlobal){const t=s.surface.extent;if(r(t)&&(0===e&&s.extent[3]>t[3]||1===e&&s.extent[2]>t[2]||2===e&&s.extent[1]<t[1]||3===e&&s.extent[0]<t[0]))return a}const n=s.level,o=b[e];if(!t)return E(i(s.surface?.rootTiles)||s.surface.updatingRootTiles||!s.shouldHaveNeighbor(o)),a;if(t.isLoaded){const r=t,i=r.renderData.geometryState,s=n-r.level;if(E(s>=0),0===s){const e=i.numVerticesPerSide-1;return Math.max(e,a)}const o=2**s,l=i.neighborData.edgeResolutions[(e+2)%4]/o;return Math.max(1,l)}E(!t.isLeaf);let l=a;return t.forAllSubtreeOnSide(T(o),(e=>e===s||(e.isLoaded?(l=Math.max(l,2**(e.level-n)),!0):(E(!e.isLeaf),!1)))),l}updateNeighborData(){const e=this.tile;if(!e.intersectsClippingArea)return;const r=e.renderData.geometryState.neighborData,i=t=>(t.isLoaded||t.level===e.level)&&t?.intersectsClippingArea,s=r.edgePeerNeighbors,a=r.edgePeerNeighborSamplerVersions;for(let o=0;o<4;++o){const n=e.findNeighborTile(b[o],i),l=z(e,n),h=l?.renderData?.geometryState.samplerDataVersion??-1,d=s[o],g=l!==z(e,d),c=a[o]!==h;s[o]=n,(g||c)&&(a[o]=h,this._markEdgeDirty(o));const u=r.edgeResolutions[o],m=this._calculateEdgeResolution(o,n);E(t(m)),E(m>=1),r.edgeResolutions[o]=m,u!==m&&this._markEdgeResolutionDirty(o)}const n=r.cornerPeerNeighbors;for(let t=0;t<4;++t){const a=e.findNeighborTile(j[t],i);n[t]=a;const o=z(e,s[t]),l=z(e,s[(t+1)%4]),h=z(e,a);q[t]=h,q[(t+1)%4]=l,q[(t+2)%4]=e,q[(t+3)%4]=o,E(q.some((t=>t?.isLoaded||t===e)));const d=q.reduce(((e,t)=>Math.min(e,t?.level??1/0)),1/0);q.forEach(((e,t)=>{e&&e?.level>d&&(q[t]=null)})),E(q.some((t=>t?.isLoaded||t===e)));const g=r.cornerNeighborData[t].cornerTiles,c=r.cornerNeighborData[t].cornerTileSamplerVersions;for(let e=0;e<4;++e){const r=q[e],i=r?.renderData.geometryState.samplerDataVersion??-1,s=g[e]!==r,a=!s&&c[e]!==i;(s||a)&&(g[e]=r,c[e]=i,this._markCornerDirty(t))}E(g.some((t=>t?.isLoaded||t===e)))}$&&E(this.geometryState.neighborData.edgeResolutions.every((e=>e>0)));for(let t=0;t<4;++t)q[t]=null}_updateGeometry(e){if(!this.tile.intersectsClippingArea)return;$&&E(!this.tile.intersectsClippingArea||this.geometryState.neighborData.edgeResolutions.every((e=>e>0))),this.intersectionData=null;const t=this.tile,r=this._vao,i=this.geometryInfo.vertexAttributes,s=!r||!i||this._wireframeChanged||this._shadingChanged||this._numVerticesPerSideChanged||this._samplerDataChanged||this._clippingAreaChanged||this._dirtyEdgeResolutions,a=!s&&(0!==this._dirtyEdges||0!==this._dirtyEdgeResolutions),n=!a&&0!==this._dirtyCorners;s?(this.releaseGeometry(),this._createGeometry(e)):a||n?t.updateEdgeElevations():n?t.updateCornerElevations():console.warn("Update for no reason?"),this._numVerticesPerSideChanged=!1,this._samplerDataChanged=!1,this._dirtyEdgeResolutions=0,this._dirtyEdges=0,this._dirtyCorners=0,this._clippingAreaChanged=!1,this._wireframeChanged=!1,this._shadingChanged=!1}get hasGeometry(){return this._hasGeometry}releaseGeometry(){return this._hasGeometry=!1,this.intersectionData=null,!!this._vao&&(this._vao.dispose(),this._vao=null,S(this.geometryInfo),!0)}ensureTexture(e,t){return r(this._texture)&&this._texture.descriptor.width!==e&&this.releaseTexture(),i(this._texture)&&(this._texture=t(),this.tile.setMemoryDirty()),this._texture}releaseTexture(){r(this._texture)&&(this._texture.release(),this._texture=null,this.tile.setMemoryDirty())}_markCornerDirty(e){const t=1<<e;this._dirtyCorners|=t}_markEdgeDirty(e){const t=1<<e;this._dirtyEdges|=t}_markEdgeResolutionDirty(e){const t=1<<e;this._dirtyEdgeResolutions|=t,this._dirtyEdges|=t}_markAllEdgesAndCornersDirty(){this._dirtyCorners=15,this._dirtyEdges=15,this._dirtyEdgeResolutions=15}updateGeometryState(){const t=this._getElevationInfo(),r=this.tile,i=t.samplerData?r.getElevationBasedVerticesPerSide(t.maxTileLevel):r.getDefaultVerticesPerRowOnLevel(),s=Math.max(i,5);let a=r.clippingArea;r.intersectsClippingArea&&!r.isWithinClippingArea||(a=null);const n=this.geometryState;let o=!1;n.numVerticesPerSide!==s&&(this._numVerticesPerSideChanged=!0,n.numVerticesPerSide=s,n.samplerDataVersion++,o=!0),t.changed&&(this._samplerDataChanged=!0,n.samplerData=t.samplerData,n.samplerDataVersion++,o=!0),e(n.clippingArea,a)||(this._clippingAreaChanged=!0,n.clippingArea=a,o=!0);const l=r.surface,h=l.wireframe;n.wireframe!==h&&(this._wireframeChanged=!0,n.wireframe=h,o=!0);const d=l.shading;return n.shading!==d&&(this._shadingChanged=d,n.shading=d,o=d),this._geometryStateChangedSinceLastUpdate||(this._geometryStateChangedSinceLastUpdate=o),o&&this._markAllEdgesAndCornersDirty(),this._hasGeometry=!0,this._geometryStateChangedSinceLastUpdate}_createGeometry(e){this.tile.createGeometry();const t=this.geometryInfo.vertexAttributes,r=this.geometryInfo.indices,i=e.gl;this._vao=new I(e,G,{geometry:_(t.layout)},{geometry:M.createVertex(e,i.STATIC_DRAW,t.buffer)},M.createIndex(e,i.STATIC_DRAW,r)),this._hasGeometry=!0}get vao(){return this._vao}setTextureReference(e,t=w.Immediate){r(e)&&e.texture!==this._texture&&this.releaseTexture(),this._textureRef.push(e,t)}get textureReference(){return this._textureRef.current}get nextTextureReference(){return this._textureRef.next}get textureFadeFactor(){return this._textureRef.fadeFactor}get textureIsFading(){return this._textureRef.isFading}_getElevationInfo(){const e=this.geometryState.samplerData,t=this.tile.layerInfo[v.ELEVATION],i=t.length,s=new Array(i);let a=0,n=0,o=!1;for(let d=0;d<i;d++){const i=t[d];if(r(i.upsampleInfo)){const t=i.upsampleInfo.tile,r=t.layerInfo[v.ELEVATION][d].data,l=r&&r.samplerData;e&&e[a]===l||(o=!0),s[a++]=l,n=Math.max(n,t.lij[0])}else if(i.data){const t=this.tile.surface.layerViewByIndex(d,v.ELEVATION);if(N(this.tile,t.layer,!1)){const t=i.data;e&&e[a]===t.samplerData||(o=!0),s[a++]=t.samplerData,n=this.tile.level}}}r(e)&&e.length!==a&&(o=!0);const l=a>0,h=l?s:null;return l&&(s.length=a),{changed:o,samplerData:h,maxTileLevel:n}}get estimatedGeometryMemoryUsage(){const e=s(this.intersectionData,0,(e=>e.estimatedMemoryUsage));return(this.geometryInfo.indices?.byteLength??0)+(this.geometryInfo.vertexAttributes?.byteLength??0)+e}get textureDescriptor(){return r(this._texture)?this._texture.descriptor:null}get test(){return{hasTexture:null!=this._texture}}checkGeometryWaterproofness(){if(!$)return;const e=this.tile;if(E(e?.isLoaded),!e.isLoaded||!e.intersectsClippingArea)return;const s=e.renderData;if(0===e.level)return;const p=e.surface.extent;if(r(p)&&!e.intersectsExtent(p))return;const _=b.map(((t,i)=>!!r(p)&&(i<2?-1:1)*(e.extent[3-i]-p[3-i])<0)),x=e.level;E(0===this._dirtyCorners),E(0===this._dirtyEdges),E(0===this._dirtyEdgeResolutions),E(!this._numVerticesPerSideChanged),E(!this._samplerDataChanged),E(!this._clippingAreaChanged),E(!this._wireframeChanged);const v=j.map((t=>e.findNeighborCornerTileExact(t,(t=>!t.intersectsClippingArea||t.isLoaded||t.level===e.level))??null)).map((e=>e?.intersectsClippingArea?e:null)),D=this.geometryState.neighborData;for(let t=0;t<4;++t){const r=D.cornerPeerNeighbors[t],i=v[t];E(i===r,`Tile[${e.lij}].corner[${t}] out of date: cur=[${r?.lij}] exp=[${i?.lij}]`)}b.forEach(((p,v)=>{if(_[v])return;const D=e.findNeighborTile(p,(e=>(e.level===x||e?.isLoaded)&&e?.intersectsClippingArea));if(!D){const t=!e.surface.updatingRootTiles&&r(e.surface.rootTiles)&&e.surface.rootTiles.length>0&&e.shouldHaveNeighbor(p);return void E(!t)}E(D.isLoaded||D.level===e.level),E(D===this.geometryState.neighborData.edgePeerNeighbors[v]);const S=x-D.level;if(!D.isLoaded)return E(!D.isLeaf),void E(0===S);const $=D.renderData;E(L(e,D,p)),E(S>=0);const b=2**S;if(S<0)return void E(!1);const T=s.geometryInfo,j=T.outerEdges[v],R=T.numVerticesPerSide-1,w=$.geometryInfo;if(!w)return void E(!1);{const e=this.geometryState.neighborData.edgePeerNeighbors[v];if(e?.isLoaded){const t=e.renderData;E(e==e),E(s.geometryState.neighborData.edgePeerNeighborSamplerVersions[v]===t.geometryState.samplerDataVersion),E(this.geometryState.neighborData.edgePeerNeighborSamplerVersions[v]===t.geometryState.samplerDataVersion)}}const P=(v+2)%4,N=w.outerEdges[P],I=j.count-1,G=N.count-1;E(I*b===G,`Tile[${e.lij}]:e${v},res=${I} edgeRes mismatch with Neighbor[${D.lij}]:e${P},res=${G} (expected:${I*b})`);const M=e.extent,O=p===C.NORTH||p===C.SOUTH,q=N.count-1,z=q/2**S,J=j.count-1;if(z<1)return void E(1===J);E(z===J),E(t(z));const K=w.numVerticesPerSide-1;E(S>0||z===Math.max(K,R));const Q=e.getNeighborEdgeStartVertexIndex(v,D);E(0<=Q&&Q<b);const Y=Q*z;E(0<=Y&&Y<=q-z);let Z=0,ee=Y;j.getVertexPos(U,0),j.getVertexPos(k,j.count-1);const te=a(U,k),re=Math.max(W,1e-4*te);for(let t=0;t<=z;++t){j.getVertexPos(U,Z),N.getVertexPos(k,ee);const a=t/z,_=O?M[0]+a*(M[2]-M[0]):p===C.WEST?M[0]:M[2],x=O?p===C.SOUTH?M[1]:M[3]:M[1]+a*(M[3]-M[1]),S=e.surface.extent;if(i(S)||f(S,_,x)){const t=n(U,k),i=o(U)-y.radius,a=o(k)-y.radius,p=t<re;if(!p){console.warn(`Tile edge vertex position mismatch: between [${e.lij}].edge${v}[${Z}/${j.count}] and [${D.lij}].edge${P}[${ee}/${N.count}]`),r(S)&&console.warn(" surface extent= ",S," x,y=",_,",",x);const n=u();l(n,s.localOrigin,$.localOrigin),o(n)>0&&console.warn(` localOrigins: ${s.localOrigin} vs ${$.localOrigin} d=${o(n)} [${n}]`);(()=>{const t=m(U),r=m(k);e.updateEdgeElevations(),D.updateEdgeElevations(),j.getVertexPos(U,Z),N.getVertexPos(k,ee);const i=u();g(i,U,t),o(i)>0&&console.warn(` XXX Tile[${e.lij}] edge out of date: ${t} vs ${U} d=${o(i)} [${i}]`),g(i,k,r),o(i)>0&&console.warn(` XXX Neighbor[${D.lij}] edge out of date: ${r} vs ${k} d=${o(i)} [${i}]`)})(),E(p,`Mismatch in tile [${e.lij}].edge[${v}][${Z}/${j.count}] vs neighbor [${D.lij}].edge[${P}][${ee}/${N.count}] ${A(U)} vs ${A(k)} dist=${t} h(t|n|d)=${i}|${a}|${a-i}`)}if(e.surface.shading){j.getNormal(F,Z),N.getNormal(B,ee),h(X,F),h(H,B);const t=d(X,H),r=1-t<.01||!1||e===D;if(!r){const i=u();g(i,F,B);const s=()=>`Mismatch in tile edge normal ${V(e.lij)} (${Z}/${j.count-1}) edge ${v} vs neighbor ${V(D.lij)} (${ee}/${N.count-1}) nedge ${P} :${A(F)} vs ${A(B)} dot = ${t} : ${A(i)}`;console.warn("Mismatch in tile edge normal: ",s());{e.updateEdgeElevations(),D.updateEdgeElevations();const t=u(),r=u();j.getNormal(t,Z),N.getNormal(r,ee),c(F,t)||console.warn("Missing update in tile normal: ",A(F)," => ",A(t)),c(B,r)||console.warn("Missing update in neighbor normal: ",A(B)," => ",A(r))}E(r,s())}}}Z+=1,ee+=1}}))}}const U=u(),k=u(),F=u(),B=u(),X=u(),H=u(),W=1,q=[null,null,null,null];function z(e,t){return t?.isLoaded||t===e?t:null}export{w as ActivationTime,O as PatchRenderData,z as neighborTileIfLoadedOrSelf};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{floatEqualAbsolute as t}from"../../core/mathUtils.js";import{a as n,v as s,h as r,w as e,e as o}from"../../chunks/vec2.js";import{d as c}from"../../chunks/vec2f64.js";import{s as u,w as f,e as
|
|
5
|
+
import{floatEqualAbsolute as t}from"../../core/mathUtils.js";import{a as n,v as s,h as r,w as e,e as o}from"../../chunks/vec2.js";import{d as c}from"../../chunks/vec2f64.js";import{s as u,w as f,e as a,z as i,b as p,l as A,i as L,f as h,u as E,D as N,d}from"../../chunks/vec3.js";import{c as m,f as y,a as P}from"../../chunks/vec3f64.js";import{LineType as R}from"./geometry2dUtils.js";function Y({start:t,end:o,type:c},u,f){const a=[],i=u,p=n(D,o,t),A=n(B,t,i),L=s(p),h=2*r(p,A),E=h*h-4*L*(s(A)-f*f);if(0===E){const n=-h/(2*L);(c===U.PLANE||n>=0)&&a.push(e(y(0,0,u[2]),t,p,n))}else if(E>0){const n=Math.sqrt(E),s=(-h+n)/(2*L);(c===U.PLANE||s>=0)&&a.push(e(y(0,0,u[2]),t,p,s));const r=(-h-n)/(2*L);(c===U.PLANE||r>=0)&&a.push(e(y(0,0,u[2]),t,p,r))}return a}function I(t,s){const e=t.start,c=t.end,p=n(D,c,e),A=u(B,-p[1],p[0],0),L=s.start,h=s.end,E=f(C,h,L),N=a(E,A),d=u(G,e[0],e[1],0),m=f(J,d,L),y=a(m,A);if(Math.abs(N)<z)return Math.abs(y),[];const Y=i(K,L,E,y/N);if(s.type===R.RAY){const t=f(O,Y,L);if(a(t,E)<-z)return[]}if(t.type===U.HALF_PLANE){const t=o(O,Y,e);if(r(t,p)<-z)return[]}return[P(Y)]}function j(t,n){return w(x(Q,n[2],t),n)}function l(t,n){const s=0,r=b(x(Q,s,t),x(S,s,n)),e=[];for(const o of r)e.push(c(o));return e}function v(t,n){return F(t,x(Q,t[2],n))}function M(t,n){return H(x(Q,t[2],n),t)}function k(t,n,s){const r=u(D,t[0],t[1],n[2]),e=p(B,r,n),o=s/A(e);return i(m(),n,e,o)}function F(t,{start:n,end:s,type:r}){const e=f(D,t,n),o=f(B,s,n),c=a(e,o)/a(o,o);return i(m(),n,o,r===R.RAY?Math.max(c,0):c)}function H({start:t,end:n,type:s},r){const e=f(D,r,t),o=f(B,n,t);if(s===R.RAY&&a(o,e)<-z)return L(t,r);const c=h(C,o,e);return E(c)/E(o)}function _({start:o,end:c,type:u},p,A){const L=[];if(t(o[2],p[2],z)&&t(c[2],p[2],z)){const t=o,f=p,a=n(D,c,t),i=n(B,t,f),h=s(a),E=2*r(a,i),N=E*E-4*h*(s(i)-A*A);if(0===N){const n=-E/(2*h);(u===R.LINE||n>=0)&&L.push(e(y(0,0,p[2]),t,a,n))}else if(N>0){const n=Math.sqrt(N),s=(-E+n)/(2*h);(u===R.LINE||s>=0)&&L.push(e(y(0,0,p[2]),t,a,s));const r=(-E-n)/(2*h);(u===R.LINE||r>=0)&&L.push(e(y(0,0,p[2]),t,a,r))}}else{const n=f(D,c,o);if(t(n[2],0,z))return L;const s=(p[2]-o[2])/n[2],r=i(B,o,n,s);if(u===R.RAY){const t=f(C,r,o);if(a(n,t)<-z)return L}for(const t of q(p,A,r))L.push(t)}return L}function b(n,s){const r=n.start,e=n.end,o=s.start,c=s.end,u=f(D,e,r),p=f(B,c,o),A=f(C,o,r),L=h(G,u,p),E=a(A,L);if(!t(E,0,z))return[];const d=N(L);if(t(d,0,z))return[];const m=h(J,A,p),y=a(m,L)/d,Y=i(K,r,u,y);if(n.type===R.RAY){const t=f(O,Y,r);if(a(u,t)<-z)return[]}if(s.type===R.RAY){const t=f(O,Y,o);if(a(p,t)<-z)return[]}return[P(Y)]}function w({start:t,end:n,type:s},r){const e=f(D,r,t),o=f(B,n,t),c=h(C,o,e);if(N(c)/N(o)<z)switch(s){case R.LINE:return[P(r)];case R.RAY:return a(o,e)<-z?[]:[P(r)]}return[]}function q(n,s,r){return t(n[2],r[2],z)&&t(d(r,n),s*s,z)?[P(r)]:[]}function x(t,n,{start:s,end:r,type:e}){return u(t.start,s[0],s[1],n),u(t.end,r[0],r[1],n),t.type=g[e],t}var U;!function(t){t[t.PLANE=0]="PLANE",t[t.HALF_PLANE=1]="HALF_PLANE"}(U||(U={}));const g={[U.PLANE]:R.LINE,[U.HALF_PLANE]:R.RAY},z=1e-6,D=m(),B=m(),C=m(),G=m(),J=m(),K=m(),O=m(),Q={start:m(),end:m(),type:R.LINE},S={start:m(),end:m(),type:R.LINE};export{R as LineType,U as VerticalPlaneType,z as epsilon,q as intersectCircleAndPoint,w as intersectLineAndPoint,b as intersectLineLike,_ as intersectLineLikeAndCircle,l as intersectVerticalPlane,Y as intersectVerticalPlaneAndCircle,I as intersectVerticalPlaneAndLineLike,j as intersectVerticalPlaneAndPoint,H as pointToLineLikeDistance,M as pointToVerticalPlaneDistance,k as projectPointToCircle,F as projectPointToLineLike,v as projectPointToVerticalPlane};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Error.js";import{
|
|
5
|
+
import e from"../../../core/Error.js";import{isSome as t,isNone as a}from"../../../core/maybe.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{isTiledLayer as r,isBasemapSupportedLayer as n}from"../../../layers/support/layerUtils.js";import{stringFromViewingMode as s,ViewingMode as o}from"../../../views/ViewingMode.js";import{getTileInfoAndExtentFromWMTSLayer as l,checkIfTileInfoSupportedForView as p}from"../../../views/3d/terrain/terrainUtils.js";import{TilingScheme as c}from"../../../views/3d/terrain/TilingScheme.js";import{isSpatialReferenceSupported as m}from"../../../views/support/spatialReferenceSupport.js";async function f(e,t={}){await y(e,t),i(t)}async function u(e,a={}){const{basemap:n,view:s}=e;if(i(a),"spatialReferenceLocked"in s&&!s.spatialReferenceLocked)return;if(await n.load(a),i(a),0===n.baseLayers.length)return;const o=n.baseLayers.getItemAt(0);if(!r(o))return;if(n.spatialReference){if(s.spatialReference.equals(n.spatialReference))return;w()}await o.load(a),i(a);const l=(("supportedSpatialReferences"in o?o.supportedSpatialReferences:null)||["tileInfo"in o?o.tileInfo?.spatialReference:null]).filter(t);0!==l.length&&l.every((e=>!s.spatialReference.equals(e)))&&w()}function w(){throw new e("basemap-compatibility:incompatible-spatial-reference","Basemap spatial reference is not compatible with the view")}async function y(t,a){const{basemap:i,view:r}=t;if(await i.load(a),0===i.baseLayers.length)return;const s=i.baseLayers.concat(i.referenceLayers).toArray().filter((e=>!n(e))).map((t=>new e("basemap-compatibility:unsupported-basemap-layer-type","Unsupported basemap layer type ${operationalLayerType}",{layer:t,operationalLayerType:t.operationalLayerType||"unknown"})));if(s.length)throw s[0];const o=i.baseLayers.getItemAt(0);if(n(o)){try{await o.load(a)}catch(l){const t="basemap-compatibility:unknown-error",a="Unknown basemap compatibility error",{name:i=t,message:r=a,details:n}=l;throw new e(i,r,n)}b(o,r)}}function b(i,r){const n=r.state.viewingMode;if(!n)return;let f,u;if("wmts"===i?.type){const t=l(i,r.spatialReference,n);if(a(t.tileInfo))throw new e("basemapgalleryitem:tiling-scheme-incompatible","Basemap tiling scheme is incompatible with the view");f=t.tileInfo,u=t.fullExtent}else f=i.tileInfo,u=i.fullExtent;if(a(f))return;if(!m(f.spatialReference,n))throw new e(`basemapgalleryitem:spatial-reference-unsupported-${s(n)}`,`Basemap spatial reference is unsupported in ${s(n)} mode`);const w=f.spatialReference.isGeographic,y="vector-tile"===i?.type?f.getOrCreateCompatible(256,w?1:2):null;if(n===o.Global){let a=p(f,u,null,n);if(a&&"vector-tile"===i?.type&&t(u)&&y&&!p(y,u,null,n)&&(a=null),a){const t=f.spatialReference.isWebMercator?"web-mercator":"wgs84";throw new e(`basemapgalleryitem:tiling-scheme-unsupported-${t}-global`,"Basemap tiling scheme is unsupported in global mode",{error:a})}}else if(c.checkUnsupported(f))throw new e("basemapgalleryitem:tiling-scheme-unsupported-local","Basemap tiling scheme is unsupported in local mode");const b=r.get("basemapTerrain.tilingScheme");if(b&&!b.compatibleWith(f)&&("vector-tile"!==i?.type||!y||!b.compatibleWith(y)))throw new e("basemapgalleryitem:tiling-scheme-incompatible","Basemap tiling scheme is incompatible with the view")}export{u as default2DCompatibility,f as default3DCompatibility};
|
package/widgets/Daylight.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Logger.js";import{applySome as i,isNone as s}from"../core/maybe.js";import{watch as o,syncAndInitial as l,when as r}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import{CSS as c}from"./Daylight/css.js";import h from"./Daylight/DaylightViewModel.js";import p from"./Daylight/VisibleElements.js";import{ORDERED_SEASONS as m}from"./Daylight/support/daylightUtils.js";import g from"./Daylight/support/SliderWithDropdown.js";import u from"./support/DatePicker.js";import{Heading as y}from"./support/Heading.js";import{getTimezoneInfos as b}from"./support/timeWidgetUtils.js";import"./support/widgetUtils.js";import{messageBundle as v}from"./support/decorators/messageBundle.js";import{tsx as w,tsxFragment as _}from"./support/jsxFactory.js";const S=/(.*)\s(.*)/,k="date",f="esri.widgets.Daylight";let M=class extends d{constructor(e,t){super(e,t),this.headingLevel=3,this.iconClass=c.widgetIcon,this.viewModel=new h,this.visibleElements=new p,this.dateOrSeason=k,this._timeSlider=new g({viewModel:this.viewModel.timeSliderViewModel,steps:this.timeSliderSteps,labelInputsEnabled:!1,visibleElements:{labels:!0},tickConfigs:[{mode:"position",values:[0,360,720,1080,1439],labelsVisible:!0,tickCreatedFunction:this._onPrimaryTickCreated.bind(this)},{mode:"position",values:[120,240,480,600,840,960,1200,1320],tickCreatedFunction:this._onSecondaryTickCreated.bind(this)}],items:[]}),this._datePicker=new u({viewModel:this.viewModel.datePickerViewModel,commitOnMonthChange:!0}),this._onPlayDayClick=()=>{this.viewModel.toggleDayPlaying()},this._onYearPlayClick=()=>{this.viewModel.toggleYearPlaying()},this._onSeasonChange=e=>{const t=e.target;this.viewModel.currentSeason=t.value},this._onSunLightingCheckboxChange=()=>{this.viewModel.toggleSunLightingEnabled()},this._onShadowCheckboxChange=()=>{this.viewModel.toggleDirectShadowsEnabled()}}get gmtOffsets(){return i(this.timezoneMessages,b)}get label(){return this.messages?.title??""}set label(e){this._overrideIfSome("label",e)}get playSpeedMultiplier(){return this.viewModel.playSpeedMultiplier}set playSpeedMultiplier(e){this.viewModel.playSpeedMultiplier=e}get timeSliderSteps(){return this._timeSlider?.steps??5}set timeSliderSteps(e){this._timeSlider.steps=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get _useAmPm(){const e=this._timeSlider.viewModel.getLabelForValue(0,"tick");return S.test(e)}get _labelAlignmentClass(){const e=this.viewModel.timeSliderViewModel.values?.[0]??0,t=60*(this._useAmPm?4:3),i=60*(this._useAmPm?21:21.5);return e<t?c.sliderAlignLeft:e>i?c.sliderAlignRight:null}postInitialize(){this.viewModel.isSupported&&this.addHandles([o((()=>this.viewModel.datePickerViewModel),(e=>this._datePicker.viewModel=e),l),o((()=>this.viewModel.timeSliderViewModel),(e=>this._timeSlider.viewModel=e),l),o((()=>this.timezoneMessages.chooseTimezone),(e=>this._timeSlider.buttonTooltip=e),l),o((()=>this.visibleElements?.timezone),(e=>this._timeSlider.showDropDown=e),l),o((()=>!this.viewModel.sunLightingEnabled),(e=>{this._datePicker.disabled=e,this._timeSlider.disabled=e}),l),r((()=>this.gmtOffsets),(e=>{this._timeSlider.items=e.map((e=>({utcOffset:e.utcOffset,name:e.short,label:[e.shortWithUTC,e.long]})))}),l),o((()=>[this.viewModel.utcOffset,this.gmtOffsets]),(()=>this._onUTCOffsetChange()),l)])}destroy(){this._datePicker.destroy(),this._timeSlider.destroy()}render(){const{messages:e,viewModel:t,visibleElements:i}=this,s=t.isSupported;return w("div",{class:this.classes(c.base,c.widget)},s?w(_,null,i.header&&w(y,{level:this.headingLevel},e.title),this._renderTimeOptions(),i.datePicker&&this._renderDateOrSeason(),i.sunLightingToggle&&this._renderSunLightingToggle(),i.shadowsToggle&&this._renderShadowsToggle()):w("div",{key:"unsupported",class:c.panelError},w("p",null,e.unsupported)))}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-checkbox.js"),import("@esri/calcite-components/dist/components/calcite-label.js")])}_renderTimeOptions(){const{viewModel:e,visibleElements:t,messages:i}=this,{directShadowsEnabled:s,dayPlaying:o}=e,l=!e.sunLightingEnabled;return w("div",{class:this.classes(c.dayContainer,this._labelAlignmentClass,{[c.shadowOn]:s,[c.shadowOff]:!s,[c.sliderDateOn]:t.datePicker,[c.sliderDateOff]:!t.datePicker,[c.sliderAmPmOn]:this._useAmPm,[c.containerDisabled]:l}),key:"daylight-time-options"},this._timeSlider.render(),t.playButtons&&this._renderPlayPauseButton({playing:o,disabled:l,label:i.playDay,onClick:this._onPlayDayClick}))}_renderDateOptions(){const{viewModel:e,visibleElements:t,messages:i}=this,{yearPlaying:s}=e,o=!e.sunLightingEnabled;return w("div",{key:"daylight-date-options",class:this.classes(c.dateContainer,o&&c.containerDisabled)},this._datePicker.render(),t.playButtons&&this._renderPlayPauseButton({playing:s,disabled:o,label:i.playYear,onClick:this._onYearPlayClick}))}_renderPlayPauseButton({playing:e,disabled:t,label:i,onClick:s}){return w("calcite-button",{appearance:"solid",class:c.playPauseButton,disabled:t,
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Logger.js";import{applySome as i,isNone as s}from"../core/maybe.js";import{watch as o,syncAndInitial as l,when as r}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import{CSS as c}from"./Daylight/css.js";import h from"./Daylight/DaylightViewModel.js";import p from"./Daylight/VisibleElements.js";import{ORDERED_SEASONS as m}from"./Daylight/support/daylightUtils.js";import g from"./Daylight/support/SliderWithDropdown.js";import u from"./support/DatePicker.js";import{Heading as y}from"./support/Heading.js";import{getTimezoneInfos as b}from"./support/timeWidgetUtils.js";import"./support/widgetUtils.js";import{messageBundle as v}from"./support/decorators/messageBundle.js";import{tsx as w,tsxFragment as _}from"./support/jsxFactory.js";const S=/(.*)\s(.*)/,k="date",f="esri.widgets.Daylight";let M=class extends d{constructor(e,t){super(e,t),this.headingLevel=3,this.iconClass=c.widgetIcon,this.viewModel=new h,this.visibleElements=new p,this.dateOrSeason=k,this._timeSlider=new g({viewModel:this.viewModel.timeSliderViewModel,steps:this.timeSliderSteps,labelInputsEnabled:!1,visibleElements:{labels:!0},tickConfigs:[{mode:"position",values:[0,360,720,1080,1439],labelsVisible:!0,tickCreatedFunction:this._onPrimaryTickCreated.bind(this)},{mode:"position",values:[120,240,480,600,840,960,1200,1320],tickCreatedFunction:this._onSecondaryTickCreated.bind(this)}],items:[]}),this._datePicker=new u({viewModel:this.viewModel.datePickerViewModel,commitOnMonthChange:!0}),this._onPlayDayClick=()=>{this.viewModel.toggleDayPlaying()},this._onYearPlayClick=()=>{this.viewModel.toggleYearPlaying()},this._onSeasonChange=e=>{const t=e.target;this.viewModel.currentSeason=t.value},this._onSunLightingCheckboxChange=()=>{this.viewModel.toggleSunLightingEnabled()},this._onShadowCheckboxChange=()=>{this.viewModel.toggleDirectShadowsEnabled()}}get gmtOffsets(){return i(this.timezoneMessages,b)}get label(){return this.messages?.title??""}set label(e){this._overrideIfSome("label",e)}get playSpeedMultiplier(){return this.viewModel.playSpeedMultiplier}set playSpeedMultiplier(e){this.viewModel.playSpeedMultiplier=e}get timeSliderSteps(){return this._timeSlider?.steps??5}set timeSliderSteps(e){this._timeSlider.steps=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get _useAmPm(){const e=this._timeSlider.viewModel.getLabelForValue(0,"tick");return S.test(e)}get _labelAlignmentClass(){const e=this.viewModel.timeSliderViewModel.values?.[0]??0,t=60*(this._useAmPm?4:3),i=60*(this._useAmPm?21:21.5);return e<t?c.sliderAlignLeft:e>i?c.sliderAlignRight:null}postInitialize(){this.viewModel.isSupported&&this.addHandles([o((()=>this.viewModel.datePickerViewModel),(e=>this._datePicker.viewModel=e),l),o((()=>this.viewModel.timeSliderViewModel),(e=>this._timeSlider.viewModel=e),l),o((()=>this.timezoneMessages.chooseTimezone),(e=>this._timeSlider.buttonTooltip=e),l),o((()=>this.visibleElements?.timezone),(e=>this._timeSlider.showDropDown=e),l),o((()=>!this.viewModel.sunLightingEnabled),(e=>{this._datePicker.disabled=e,this._timeSlider.disabled=e}),l),r((()=>this.gmtOffsets),(e=>{this._timeSlider.items=e.map((e=>({utcOffset:e.utcOffset,name:e.short,label:[e.shortWithUTC,e.long]})))}),l),o((()=>[this.viewModel.utcOffset,this.gmtOffsets]),(()=>this._onUTCOffsetChange()),l)])}destroy(){this._datePicker.destroy(),this._timeSlider.destroy()}render(){const{messages:e,viewModel:t,visibleElements:i}=this,s=t.isSupported;return w("div",{class:this.classes(c.base,c.widget)},s?w(_,null,i.header&&w(y,{level:this.headingLevel},e.title),this._renderTimeOptions(),i.datePicker&&this._renderDateOrSeason(),i.sunLightingToggle&&this._renderSunLightingToggle(),i.shadowsToggle&&this._renderShadowsToggle()):w("div",{key:"unsupported",class:c.panelError},w("p",null,e.unsupported)))}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-checkbox.js"),import("@esri/calcite-components/dist/components/calcite-label.js")])}_renderTimeOptions(){const{viewModel:e,visibleElements:t,messages:i}=this,{directShadowsEnabled:s,dayPlaying:o}=e,l=!e.sunLightingEnabled;return w("div",{class:this.classes(c.dayContainer,this._labelAlignmentClass,{[c.shadowOn]:s,[c.shadowOff]:!s,[c.sliderDateOn]:t.datePicker,[c.sliderDateOff]:!t.datePicker,[c.sliderAmPmOn]:this._useAmPm,[c.containerDisabled]:l}),key:"daylight-time-options"},this._timeSlider.render(),t.playButtons&&this._renderPlayPauseButton({playing:o,disabled:l,label:i.playDay,onClick:this._onPlayDayClick}))}_renderDateOptions(){const{viewModel:e,visibleElements:t,messages:i}=this,{yearPlaying:s}=e,o=!e.sunLightingEnabled;return w("div",{key:"daylight-date-options",class:this.classes(c.dateContainer,o&&c.containerDisabled)},this._datePicker.render(),t.playButtons&&this._renderPlayPauseButton({playing:s,disabled:o,label:i.playYear,onClick:this._onYearPlayClick}))}_renderPlayPauseButton({playing:e,disabled:t,label:i,onClick:s}){return w("calcite-button",{appearance:"solid",class:c.playPauseButton,disabled:t,iconStart:e?"pause-f":"play-f",label:i,round:!0,title:i,type:"button",onclick:s})}_renderSeasonOptions(){const{messages:e,viewModel:t}=this,i=!t.sunLightingEnabled;return w("select",{class:this.classes(c.select,c.seasonPicker,i&&c.seasonPickerDisabled),disabled:i,value:t.currentSeason,"aria-label":e.season,onchange:this._onSeasonChange},m.map((t=>w("option",{value:t},e[t]))))}_renderDateOrSeason(){return"date"===this.dateOrSeason?this._renderDateOptions():this._renderSeasonOptions()}_renderSunLightingToggle(){const e=this.messages?.sunLightingToggle;return w("calcite-label",{key:"date-time-toggle",layout:"inline",title:e?.tooltip,scale:"s"},w("calcite-checkbox",{class:c.sunLightingCheckbox,checked:this.viewModel.sunLightingEnabled,onCalciteCheckboxChange:this._onSunLightingCheckboxChange}),e?.label)}_renderShadowsToggle(){const e=this.messages.shadowsToggle;return w("calcite-label",{key:"shadow-toggle",layout:"inline",title:e?.tooltip,scale:"s"},w("calcite-checkbox",{class:c.shadowsCheckbox,checked:this.viewModel.directShadowsEnabled,onCalciteCheckboxChange:this._onShadowCheckboxChange}),e.label)}_onUTCOffsetChange(){const e=this.viewModel.utcOffset,t=this._timeSlider.currentItem?.utcOffset,i=this.gmtOffsets;if(s(i)||t===e)return;const o=i.findIndex((({utcOffset:t})=>t===e));o>-1&&(this._timeSlider.currentIndex=o)}_onPrimaryTickCreated(e,t,i){t.classList.add(...C,c.primaryTick),i.classList.add(...C,c.primaryTickLabel),i.onclick=t.onclick=this._makeGoToTime(e);const s=S.exec(i.textContent);s&&(i.innerHTML=`${s[1]}<br><div class=${c.primaryTickAmPm}>${s[2]}</div>`)}_onSecondaryTickCreated(e,t){t.classList.add(...C,c.secondaryTick),t.onclick=this._makeGoToTime(e)}_makeGoToTime(e){return()=>{this.viewModel.timeSliderPosition=e}}};e([a({readOnly:!0})],M.prototype,"gmtOffsets",null),e([a(),v("esri/widgets/Daylight/t9n/Daylight")],M.prototype,"messages",void 0),e([a(),v("esri/widgets/support/t9n/timezone")],M.prototype,"timezoneMessages",void 0),e([a()],M.prototype,"headingLevel",void 0),e([a()],M.prototype,"iconClass",void 0),e([a()],M.prototype,"label",null),e([a()],M.prototype,"playSpeedMultiplier",null),e([a()],M.prototype,"timeSliderSteps",null),e([a()],M.prototype,"view",null),e([a({type:h})],M.prototype,"viewModel",void 0),e([a({type:p,nonNullable:!0})],M.prototype,"visibleElements",void 0),e([a({cast:e=>"season"===e||"date"===e?e:(t.getLogger(f).warn(`"${e}" is not a valid option. Acceptable values are only "date" or "season". Defaulting to "${k}".`),k)})],M.prototype,"dateOrSeason",void 0),e([a()],M.prototype,"_timeSlider",void 0),e([a()],M.prototype,"_useAmPm",null),e([a()],M.prototype,"_labelAlignmentClass",null),e([a()],M.prototype,"_datePicker",void 0),M=e([n(f)],M);const C=["esri-interactive","esri-widget__anchor"],P=M;export{P as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{isNone as s}from"../../../core/maybe.js";import{isAbortError as t}from"../../../core/promiseUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import o from"../../../portal/Portal.js";import i from"../../Widget.js";import"../../support/widgetUtils.js";import{messageBundle as l}from"../../support/decorators/messageBundle.js";import{tsx as n}from"../../support/jsxFactory.js";const c="esri-save-layer",m={panel:`${c}`,error:`${c}__error`,errorIcon:`${c}__error-icon`,errorLabel:`${c}__error-label`,layerNameLabel:`${c}__layer-name-label`,portalFolderLabel:`${c}__portal-folder-label`,processLabel:`${c}__process-label`,processLoader:`${c}__process-loader`};let p=class extends i{constructor(e,s){super(e,s),this._folders=null,this._layer=null,this._userName=null,this.messages=null,this.messagesCommon=null,this.messagesIdentity=null,this.opened=!1,this.state="initialized",this.close=()=>{this.opened=!1,this.state="initialized"}}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-combobox.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-input.js"),import("@esri/calcite-components/dist/components/calcite-label.js"),import("@esri/calcite-components/dist/components/calcite-loader.js"),import("@esri/calcite-components/dist/components/calcite-panel.js")])}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}async open(e){this.state="initialized",this.opened=!0,this._layer=e,this.state="connect-to-portal";const s=o.getDefault();try{await s.signIn()}catch(a){return void(t(a)||"identity-manager:user-aborted"===a.name?this.close():this.state="connect-to-portal-error")}this.state="fetch-portal-information";const{user:r}=s;this._userName=r.username;try{this._folders=await r.fetchFolders()}catch{return void(this.state="fetch-portal-information-error")}this.state="save-layer"}render(){switch(this.state){case"initialized":return this._renderInitialized();case"connect-to-portal":return this._renderProcess(this.messagesIdentity.lblSigning);case"connect-to-portal-error":return this._renderError(this.messages.errors.authenticating);case"fetch-portal-information":return this._renderProcess(this.messages.processing.fetching);case"fetch-portal-information-error":return this._renderError(this.messages.errors.fetching);case"save-layer":return this._renderSaveLayer();case"saving":return this._renderProcess(this.messages.processing.saving);case"saving-error":return this._renderError(this.messages.errors.saving)}}_renderError(e){return n("calcite-panel",{class:m.panel,heading:this.messages.widgetLabel,key:`${c}-error-panel`},n("div",{class:m.error},n("calcite-icon",{class:m.errorIcon,icon:"exclamation-mark-triangle",scale:"l",
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{isNone as s}from"../../../core/maybe.js";import{isAbortError as t}from"../../../core/promiseUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import o from"../../../portal/Portal.js";import i from"../../Widget.js";import"../../support/widgetUtils.js";import{messageBundle as l}from"../../support/decorators/messageBundle.js";import{tsx as n}from"../../support/jsxFactory.js";const c="esri-save-layer",m={panel:`${c}`,error:`${c}__error`,errorIcon:`${c}__error-icon`,errorLabel:`${c}__error-label`,layerNameLabel:`${c}__layer-name-label`,portalFolderLabel:`${c}__portal-folder-label`,processLabel:`${c}__process-label`,processLoader:`${c}__process-loader`};let p=class extends i{constructor(e,s){super(e,s),this._folders=null,this._layer=null,this._userName=null,this.messages=null,this.messagesCommon=null,this.messagesIdentity=null,this.opened=!1,this.state="initialized",this.close=()=>{this.opened=!1,this.state="initialized"}}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-combobox.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-input.js"),import("@esri/calcite-components/dist/components/calcite-label.js"),import("@esri/calcite-components/dist/components/calcite-loader.js"),import("@esri/calcite-components/dist/components/calcite-panel.js")])}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}async open(e){this.state="initialized",this.opened=!0,this._layer=e,this.state="connect-to-portal";const s=o.getDefault();try{await s.signIn()}catch(a){return void(t(a)||"identity-manager:user-aborted"===a.name?this.close():this.state="connect-to-portal-error")}this.state="fetch-portal-information";const{user:r}=s;this._userName=r.username;try{this._folders=await r.fetchFolders()}catch{return void(this.state="fetch-portal-information-error")}this.state="save-layer"}render(){switch(this.state){case"initialized":return this._renderInitialized();case"connect-to-portal":return this._renderProcess(this.messagesIdentity.lblSigning);case"connect-to-portal-error":return this._renderError(this.messages.errors.authenticating);case"fetch-portal-information":return this._renderProcess(this.messages.processing.fetching);case"fetch-portal-information-error":return this._renderError(this.messages.errors.fetching);case"save-layer":return this._renderSaveLayer();case"saving":return this._renderProcess(this.messages.processing.saving);case"saving-error":return this._renderError(this.messages.errors.saving)}}_renderError(e){return n("calcite-panel",{class:m.panel,heading:this.messages.widgetLabel,key:`${c}-error-panel`},n("div",{class:m.error},n("calcite-icon",{class:m.errorIcon,icon:"exclamation-mark-triangle",scale:"l",textLabel:this.messagesCommon.errorMessage}),n("calcite-label",{class:m.errorLabel},e)),n("calcite-button",{appearance:"outline",onclick:this.close,slot:"footer-actions",width:"half"},this.messagesCommon.close))}_renderInitialized(){return n("calcite-panel",{class:m.panel,heading:this.messages.widgetLabel,key:`${c}-initialize-panel`})}_renderProcess(e){return n("calcite-panel",{class:m.panel,heading:this.messages.widgetLabel,key:`${c}-process-panel`},n("calcite-loader",{class:m.processLoader,label:e}),n("calcite-label",{class:m.processLabel,alignment:"center"},e))}_renderSaveLayer(){if(s(this._layer)||s(this._folders)||s(this._userName))return this._renderInitialized();const{stops:e}=this._layer,t=`${e.getItemAt(0).name} - ${e.getItemAt(e.length-1).name}`,r=this._folders.map((e=>n("calcite-combobox-item",{key:`${c}-folder-${e.id}`,textLabel:e.title,value:e.id})));return r.unshift(n("calcite-combobox-item",{key:`${c}-folder-home`,selected:!0,textLabel:`${this._userName} (${this.messagesCommon.home})`,value:null})),n("calcite-panel",{class:m.panel,heading:this.messages.widgetLabel,key:`${c}-save-panel`},n("calcite-label",{class:m.layerNameLabel},this.messages.laverName,n("calcite-input",{afterCreate:e=>{this._layerNameInput=e},label:this.messages.laverName,value:t})),n("calcite-label",{class:m.portalFolderLabel},this.messages.saveInFolder,n("calcite-combobox",{afterCreate:e=>{this._portalFolderCombobox=e},label:this.messages.saveInFolder,overlayPositioning:"fixed",selectionMode:"single"},r)),n("calcite-button",{onclick:()=>this._saveButtonClick(),slot:"footer-actions",width:"half"},this.messagesCommon.save),n("calcite-button",{appearance:"outline",onclick:()=>{this.close()},slot:"footer-actions",width:"half"},this.messagesCommon.cancel))}_saveButtonClick(){this.state="saving",this._saveLayer().then((()=>{this.close()})).catch((()=>{this.state="saving-error"}))}async _saveLayer(){if(s(this._layer)||s(this._folders))return;const e=this._layerNameInput.value,t=this._portalFolderCombobox.value,r=this._folders.find((e=>e.id===t));await this._layer.saveAs({title:e},{folder:r})}};e([r()],p.prototype,"label",null),e([r(),l("esri/widgets/support/t9n/SaveLayer")],p.prototype,"messages",void 0),e([r(),l("esri/t9n/common")],p.prototype,"messagesCommon",void 0),e([r(),l("esri/identity/t9n/identity")],p.prototype,"messagesIdentity",void 0),e([r()],p.prototype,"opened",void 0),e([r()],p.prototype,"state",void 0),p=e([a("esri.widgets.Directions.SaveLayer")],p);export{p as SaveLayer};
|