@arcgis/core 4.34.0-next.66 → 4.34.0-next.67
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/WebDocument2D.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{09dd8613bc03e7a3a4cb.js → 0814676e4bac81f96140.js} +1 -1
- package/assets/esri/core/workers/chunks/{44031bef6d500167ef0b.js → 09dbb3e200ef8d514eb3.js} +1 -1
- package/assets/esri/core/workers/chunks/0b71100fa1e7ca706dbb.js +1 -0
- package/assets/esri/core/workers/chunks/{3167230555c63f943485.js → 0cbd5335cc92f5891bcf.js} +1 -1
- package/assets/esri/core/workers/chunks/{16fe21ca9b24eaee3069.js → 144bfd64daf103a06734.js} +1 -1
- package/assets/esri/core/workers/chunks/{c20aead85cdea91c4b74.js → 170ec7fb070c63230c81.js} +1 -1
- package/assets/esri/core/workers/chunks/{af1030e4c4437d4eb600.js → 1ada9e6cdd6792e3847a.js} +1 -1
- package/assets/esri/core/workers/chunks/1e86df439c564fe752e3.js +1 -0
- package/assets/esri/core/workers/chunks/{4459c8e495a37d4c4eb8.js → 25118304c9a914194e90.js} +1 -1
- package/assets/esri/core/workers/chunks/{d823277612f971a9c2f0.js → 3245663da75e168bf85c.js} +1 -1
- package/assets/esri/core/workers/chunks/37d7c249114994a7dfac.js +1 -0
- package/assets/esri/core/workers/chunks/{1c7b5ca80e80c314f78d.js → 39d69afc9da9db0c75ab.js} +1 -1
- package/assets/esri/core/workers/chunks/{dbcef57073075e9cfdfe.js → 489fa17e60f25d5f33ae.js} +1 -1
- package/assets/esri/core/workers/chunks/{19e5e011f929b6b940fe.js → 4bc091770bab38874848.js} +1 -1
- package/assets/esri/core/workers/chunks/{09f0c9f0b6aa58ae3c52.js → 4f22e5a7f81883e8e5b6.js} +1 -1
- package/assets/esri/core/workers/chunks/{7a17e78c76076ed4476f.js → 5185c63fecc5f493e142.js} +1 -1
- package/assets/esri/core/workers/chunks/{6fff219dfaa86167c326.js → 5303d77a3ab1b7ddeef3.js} +1 -1
- package/assets/esri/core/workers/chunks/{22ec2b0a853911692dc8.js → 5993427325d1add18ed9.js} +1 -1
- package/assets/esri/core/workers/chunks/{9e3f8c06b4e090a35710.js → 5b84eba4a28e25b6d5c0.js} +1 -1
- package/assets/esri/core/workers/chunks/{497214e9e82b936fc94e.js → 5ed381a268855bcad072.js} +1 -1
- package/assets/esri/core/workers/chunks/{33718ea851645d9078d1.js → 605acf18cbeb89e4f29f.js} +1 -1
- package/assets/esri/core/workers/chunks/{4d7fcec769369c576847.js → 6e59ba2afd444eb4be18.js} +1 -1
- package/assets/esri/core/workers/chunks/{a700f57af6856cb5313c.js → 70dc7ec6474f0801bc04.js} +1 -1
- package/assets/esri/core/workers/chunks/{60920d4856a011ace7e2.js → 80b0c88a76bd523a406a.js} +1 -1
- package/assets/esri/core/workers/chunks/{117eb1422e9795d37ea3.js → 837830e1cf712d4243a5.js} +1 -1
- package/assets/esri/core/workers/chunks/{ad7aa7d09bfceb12609e.js → 87fb5d755860057da164.js} +1 -1
- package/assets/esri/core/workers/chunks/{481aea82501d04667ba2.js → 8a104b35708a492bd614.js} +1 -1
- package/assets/esri/core/workers/chunks/{5cb238318a24b70d5ac3.js → 8bc8caa384b24af12411.js} +1 -1
- package/assets/esri/core/workers/chunks/{dcad3dcbd4ea2f5a6a04.js → 8e2558b14be70b273ce4.js} +1 -1
- package/assets/esri/core/workers/chunks/{8e40c409a9b0a2a768a9.js → 8f02349602b072186a1f.js} +1 -1
- package/assets/esri/core/workers/chunks/{fa0f94318173db2034de.js → 90491262b6d6a126c32f.js} +1 -1
- package/assets/esri/core/workers/chunks/{0952aeddddc16705b7a3.js → 99f133a152afb4f1b067.js} +1 -1
- package/assets/esri/core/workers/chunks/{8e3c09c3524654830b14.js → a634764dec5404f4a1d7.js} +1 -1
- package/assets/esri/core/workers/chunks/a895da7fd64ebad3d5a4.js +1 -0
- package/assets/esri/core/workers/chunks/{31e7358fe802abb3f8db.js → aa970a547c60c43d6c7f.js} +1 -1
- package/assets/esri/core/workers/chunks/{9a6d359ead62a8eadd3c.js → ab727ed4417b7dd94ce9.js} +1 -1
- package/assets/esri/core/workers/chunks/{707311e24b2f458d9209.js → ad3ebd4f05cc673140f3.js} +1 -1
- package/assets/esri/core/workers/chunks/{05016b0713ef760fc57d.js → b052d3ef5493eedb44a5.js} +1 -1
- package/assets/esri/core/workers/chunks/b335e96f6bcac6d2f0ee.js +1 -0
- package/assets/esri/core/workers/chunks/{dd1d9913b33d4e48baff.js → c35dad3d5ceaac6ad5a4.js} +1 -1
- package/assets/esri/core/workers/chunks/{e1b573840ec1f7c3afd3.js → c4b2678dd46fa1e22f7e.js} +1 -1
- package/assets/esri/core/workers/chunks/{bc931865a77fc48871d3.js → c94c797864a85342b105.js} +1 -1
- package/assets/esri/core/workers/chunks/{e97250ae8da4bd0d6bc9.js → cad03967e132a28512c2.js} +1 -1
- package/assets/esri/core/workers/chunks/{c7a386ac90e58eb71935.js → da1a5537e2f2ca6cc247.js} +1 -1
- package/assets/esri/core/workers/chunks/dd447dfc50ee7f511b84.js +1 -0
- package/assets/esri/core/workers/chunks/{0f9813e7d4e2b47b2c39.js → e47acdb1fbf797342716.js} +1 -1
- package/assets/esri/core/workers/chunks/{a16b471c3706ee37f9b6.js → e6f2ac738df16fb5e13a.js} +1 -1
- package/assets/esri/core/workers/chunks/{f5101f5f93f776a6456f.js → ed1272e7681e561d843f.js} +1 -1
- package/assets/esri/core/workers/chunks/{66ffefd46fe6175c2af4.js → efea3e82cec476d486e0.js} +1 -1
- package/assets/esri/core/workers/chunks/{ff2614d96ca5228e9685.js → f4d4c1f13522f20b00d1.js} +1 -1
- package/assets/esri/core/workers/chunks/{4be2bab8ff3bd14ffdfb.js → f9385d7fb5ff20f7b252.js} +1 -1
- package/assets/esri/core/workers/chunks/{b30de4936caa654d7817.js → fac020b6886ff2d75015.js} +1 -1
- package/assets/esri/core/workers/chunks/fe353a53968827bcd9cc.js +1 -0
- package/chunks/GlowComposition.glsl.js +5 -5
- package/chunks/RibbonLine.glsl.js +2 -2
- package/config.js +1 -1
- package/interfaces.d.ts +66 -193
- package/kernel.js +1 -1
- package/layers/GaussianSplatLayer.js +1 -1
- package/layers/Layer.js +1 -1
- package/layers/MapImageLayer.js +1 -1
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/VoxelLayer.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/mixins/OperationalLayer.js +1 -1
- package/layers/mixins/TemporalLayer.js +1 -1
- package/layers/mixins/TemporalSceneLayer.js +1 -1
- package/layers/mixins/operationalLayers.js +1 -1
- package/layers/support/FeatureFilter.js +1 -1
- package/layers/support/TimeInfo.js +1 -1
- package/layers/support/TrackInfo.js +1 -1
- package/layers/support/layersCreator.js +1 -1
- package/package.json +2 -2
- package/portal/schemas/definitions.js +1 -1
- package/portal/support/portalLayers.js +1 -1
- package/rest/support/AttributeBinsQuery.js +1 -1
- package/rest/support/IdentifyParameters.js +1 -1
- package/rest/support/ImageGPSInfoParameters.js +1 -1
- package/rest/support/ImageHistogramParameters.js +1 -1
- package/rest/support/ImageIdentifyParameters.js +1 -1
- package/rest/support/ImageParameters.js +1 -1
- package/rest/support/ImageSampleParameters.js +1 -1
- package/rest/support/Query.js +1 -1
- package/rest/support/TopFeaturesQuery.js +1 -1
- package/support/revision.js +1 -1
- package/support/timeUtils.js +1 -1
- package/time/TimeExtent.js +1 -1
- package/time/TimeInterval.js +1 -1
- package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
- package/views/2d/engine/webgl/Painter.js +1 -1
- package/views/2d/engine/webgl/effects/FeatureEffect.js +1 -1
- package/views/2d/engine/webgl/effects/post-processing/EffectManager.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TestTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/bloom/BloomTechnique.js +5 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/blur/BlurTechnique.js +5 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/colorize/ColorizeTechnique.js +5 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +5 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/FillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/grid/GridTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/LineTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/magnifier/MagnifierTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.js +5 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/overlay/OverlayTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlitShader.js +5 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BloomShader.js +5 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlurShader.js +5 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ColorizeShader.js +5 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js +5 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/PostProcessingShader.js +5 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/RenderState.js +1 -1
- package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
- package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +5 -0
- package/views/3d/analysis/VolumeMeasurement/volumeMeasurementGeometryUtils.js +5 -0
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
- package/views/3d/layers/graphics/QueryEngine.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureVisibilityFilter.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColor.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMask.glsl.js +5 -0
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaOutlineItem.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +5 -0
- package/views/VideoView.js +1 -1
- package/views/View.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileGenerationError.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
- package/webdoc/support/timeProperties.js +1 -1
- package/webdoc/widgets/TimeSlider.js +1 -1
- package/webmap/InitialViewProperties.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/TimeExtent.d.ts +0 -4
- package/TimeExtent.js +0 -5
- package/TimeInterval.d.ts +0 -4
- package/TimeInterval.js +0 -5
- package/assets/esri/core/workers/chunks/0b01c87db77246632ad9.js +0 -1
- package/assets/esri/core/workers/chunks/0cb2f7172190babb4139.js +0 -1
- package/assets/esri/core/workers/chunks/0e28cb5d8d89ae29cdd0.js +0 -1
- package/assets/esri/core/workers/chunks/2a938096a42613425c7b.js +0 -1
- package/assets/esri/core/workers/chunks/3bc50ee639a4d16c4f80.js +0 -1
- package/assets/esri/core/workers/chunks/8f60804c7ba445f25df8.js +0 -1
- package/assets/esri/core/workers/chunks/c696615cae5daefa2d98.js +0 -1
- package/chunks/TimeExtent.js +0 -5
- package/chunks/TimeInterval.js +0 -5
- package/views/2d/engine/webgl/effects/post-processing/Bloom.js +0 -5
- package/views/2d/engine/webgl/effects/post-processing/Blur.js +0 -5
- package/views/2d/engine/webgl/effects/post-processing/Colorize.js +0 -5
- package/views/2d/engine/webgl/effects/post-processing/DropShadow.js +0 -5
- package/views/2d/engine/webgl/effects/post-processing/Opacity.js +0 -5
- package/views/3d/webgl-engine/shaders/FocusAreaColor.glsl.js +0 -5
- package/views/3d/webgl-engine/shaders/FocusAreaMask.glsl.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{filterInPlace as s}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{getOrCreateMapValue as r}from"../../../../core/MapUtils.js";import{isAbortError as a,throwIfAborted as n}from"../../../../core/promiseUtils.js";import o from"../../../../core/ReactiveMap.js";import{on as l,watch as u}from"../../../../core/reactiveUtils.js";import{schedule as h}from"../../../../core/scheduling.js";import{signal as d}from"../../../../core/signal.js";import{sqlAnd as c}from"../../../../core/sql.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{getEpsilon as _}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as m,equals as g,clone as F,expand as y,toExtent as T,width as x,height as v}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as R,hasVertices as b,computeAABR as E}from"../../../../layers/graphics/dehydratedFeatures.js";import C from"../../../../rest/support/QuantizationParameters.js";import D from"../../../../rest/support/Query.js";import{MultiFeatureReference as w,SingleFeatureReference as M}from"./featureReference.js";import{failedFeatureCount as U,FeatureTile as j}from"./FeatureTile.js";import{virtualDisplayFilterHighlightTileId as A,virtualSnapshotTileId as I}from"./FeatureTileDescriptor.js";import{tilesAreRelated as O}from"../../terrain/tileUtils.js";import{ImmediateTask as P,TaskPriority as z}from"../../../support/Scheduler.js";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&&null!=this.context.query.queryFeatureCount}set useTileCount(e){this._useTileCount=e,this.notifyChange("useTileCount")}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get readyToRun(){return this._dirty}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}get showsAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(const e of this._featureTiles.values())if(!this.hasFullGeometries&&0!==e.emptyFeatureRatio||!e.showsAllFeatures)return!1;return!0}get hasFullGeometries(){if(!this._supportsResolution)return!0;const e=this.tileDescriptors?.some(Q);return e||!this.context.capabilities.supportsQuantization&&"polyline"!==this.context.geometryType}set filterExtent(e){if(null!=e&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference))return void i.getLogger(this).error("#filterExtent=","extent needs to be in the same spatial reference as the tiling scheme");const t=this._get("filterExtent");if(t===e||null!=t&&e&&t.equals(e))return;const s=null!=e?e.clone():null;this._set("filterExtent",s),this._reclip(s,t)}_updateTileZQuantization(e){if(1===this.context.viewingMode){const t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=d(1),this._changes={updates:{adds:new Array,removes:new Array},adds:new Array,removes:new Array},this._featureTiles=new o,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this._isFetching=!1;const t=e.context;this._frameTask=t.scheduler?.registerTask(z.FEATURE_TILE_FETCHER,this)??P,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?w:M,this._objectIdField=t.objectIdField}initialize(){this.addHandles([l(()=>this.tileDescriptors,"change",()=>this._setDirty(),{onListenerAdd:()=>this._setDirty(),onListenerRemove:()=>this._setDirty()}),u(()=>this._tileZQuantization,()=>this.refetch())]),this._setDirty()}destroy(){this._frameTask.remove(),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)}),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._setDirty()}refetchDisplayFilterHighlightTile(){const e=this._featureTiles.get(A);e&&(this._cancelFetchTile(e),this._resetFetchTile(e),this._setDirty())}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(const t of this._featureTiles.values()){const s=t.missingAttributes?.get(e);if(null!=s)return s}}_pause(){this._paused&&(this._featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach(t=>{null!=t.displayingFeatures&&0!==t.displayingFeatures.length&&(null==e?e=new Set(t.availableFields):e.forEach(s=>{t.availableFields?.has(s)||e.delete(s)}))}),null!=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(a(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),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),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),r=new Set,a=this._objectIdField;e.forEach(({objectId:e,globalId:n})=>{(!e||e<0)&&t&&n&&(s||i.getLogger(this).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`),e=this._objectIdFromGlobalId(n,a,t)),null!=e&&e>=0&&r.add(e)}),this._featureTiles.forEach(e=>{if(!e.features)return;const t=e.features.filter(e=>!r.has(R(e,this._objectIdField)));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())})}_objectIdFromGlobalId(e,t,s){if(null==e)return null;const i=this.features.find(t=>t.attributes?.[s]===e);return i?R(i,t):null}async _applyEditsAddUpdateFeatures(e,t,s){const{objectIdField:r,globalIdField:a}=this.context,n=a&&this.availableFields.has(a),o=new Set,l=new Set;for(const i of e){const e=i.objectId;null!=e&&o.add(e)}for(const{objectId:h,globalId:d}of t){let e=h;(null==e||e<0)&&a&&(n||i.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(d,r,a)),null!=e&&e>=0&&(o.add(e),l.add(e))}if(0===o.size)return;const u=[];this._featureTiles.forEach(e=>{const t=this._applyEditsAddUpdateTile(e,o,l,s);u.push(t)}),this._updated(),await Promise.allSettled(u)}async _applyEditsAddUpdateTile(e,t,s,i){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;const r=this._createQuery(e);r.resultType=void 0,r.cacheHint=!1,r.objectIds=Array.from(t);const a=await this._queryFeatures(r,i);let n=null;if(s.size>0){const t=e.features.filter(e=>!s.has(R(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)),this._applyEditsTileUpdated(),e.setFeatures(n,0,Z(e.availableFields,a.fields),V(e.missingAttributes,a.missingAttributes)),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t){return this.context.query.queryFeaturesDehydrated(e,{signal:t,timeout:J})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){const t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;const s=this._featureTilesArray;if(this._markTilesNotAlive(s),!e.run(()=>this._addTiles(s,e))||!e.run(()=>this._filterExtentTiles(s,e))||!e.run(()=>this._removeTiles(s,e))||e.done)return void this._setDirty();const i=this._sortTiles(s);e.run(()=>this._showTiles(i,e))&&e.run(()=>this._fetchTiles(i,e))&&e.run(()=>this._updateMemoryEstimates(i,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)&&(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}_showTiles(e,t){const s=this._updateRatio(e),i=e=>{const t=this._fullRatio<1?s(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();const{numFeatures:i,fetchingResolution:r,descriptor:a,isFetched:n}=e;return this._supportsResolution&&i>0&&r!==a.resolution&&n&&(e.requestRefetch(),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.needsFetch)continue;const e=null!=this.context.memoryCache?this.context.memoryCache.pop(i.id):null;if(e?.resolution!==i.displayingResolution){if(this._needsNumFeatures(i)){const e=new AbortController,r=this._fetchTileCount(i,e.signal);this._handleRequest(i,r,e,()=>i.resetFetching(),()=>i.numFeatures=U),s=!0,t.madeProgress()}if(t.done)return!0}else i.cache=e,i.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress()}if(s)return t.hasProgressed;for(const r of e){if(!r.needsFetch)continue;const e=new AbortController,s=this._fetchTile(r,e.signal);if(this._handleRequest(r,s,e,e=>r.fetchDone(e),e=>{r.fetchFailed=!0,this.context.logFetchError(i.getLogger(this),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=>{null!=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(null!=i.displayingFeatures)for(const e of i.displayingFeatures){const i=R(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;if(this._paused||this._featureTiles.forEach(t=>t.isFetching?++e:0),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set("dataUpdating",!1),this.updating){let t=0,s=0,i=0,r=0,a=0;const n=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach(e=>{if(++s,e.isFetching&&e.hasPreciseFeatureCount){const t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),s=null!=e.displayingFeatures?e.displayingFeatures.length*n:0;a+=t-s}e.needsFetch?++r:e.numFeatures>0&&(++i,t+=e.numFeatures)}),r+=e;let o=0,l=0;t?(l=t,o=Math.min(r*t/i,t)):(l=s,o=r),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set("updatingTotal",l),this._set("updatingRemaining",o),this._set("expectedFeatureDiff",a)}else this._set("updatingTotal",0),this._set("updatingRemaining",0),this._set("expectedFeatureDiff",0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(const{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e)return void this._set("maximumNumberOfFeaturesExceeded",!0);this._set("maximumNumberOfFeaturesExceeded",!1)}_updateRatio(e){const t=L(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.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))}),this._setDirty())}_addTile(e){const t=new j(e);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){const t=e.displayingResolution;this._featureTiles.forEach(s=>{if(null!=s.displayingFeatures&&e!==s&&O(e.descriptor.lij,s.descriptor.lij)){null==e.displayingFeatures&&(e.displayingFeatures=[]),e.descriptor.extent&&s.descriptor.extent&&(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(R(i,this._objectIdField));s.ref(s.feature,t),this._numDisplayingFeatureReferences++}}})}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(4):e.requestFetch()}_cancelFetchTile(e){const t=e.requestController;null!=t&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this._fetchCount(e,t),this._updateRatio(this._featureTilesArray)}async _fetchTile(e,t){e.fetchFailed=!1;const s=this._maximumFeaturesForTile(e);if(s<=0)return e.hasPreciseFeatureCount&&0===e.numFeatures||(e.fetchFailed=!0),k(e),e.fetchInformation.value="Empty tile",4;const i=this._getMaxRecordCount(e),r=Math.ceil(s/i);if(e.fetchingResolution=e.descriptor.resolution,N(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=s&&r>D.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);const a=this._createQuery(e);if(a.maxRecordCountFactor=r,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)}e.fetchInformation.value=`Single fetch\n${s} features`;const{features:o,exceededTransferLimit:l,fields:u,missingAttributes:h}=await this._queryFeatures(a,t),d=l||a.maxRecordCountFactor>=D.MAX_MAX_RECORD_COUNT_FACTOR||s===this._totalFeaturesForTile(e)?5:4,c=await this._frameTask.schedule(()=>{e.exceededTransferLimit.value=!!l;const t=this._removeEmptyFeatures(o,this._getEffectiveTileResolution(e));return e.fetchInformation.value=`Single fetch\n${o.length}/${s} features`,e.setFeatures(o,t,H(u),V(void 0,h)),this._updateTileZQuantization(e),this._maximumFeaturesForTile(e)>s?1:d},t);return n(t),this._invalidateCounts(),c}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,o=this._maximumFeaturesForTile(e)-a;const l=this._getMaxRecordCount(e);let u,h=null;for(;;){const d=this._createQuery(e),c=this._setPagingParameters(d,i,o,l);e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${o} features`;const{features:p,exceededTransferLimit:f,fields:_,missingAttributes:m}=await this._queryFeatures(d,t);if(await this._frameTask.schedule(()=>{c&&(i+=d.num),a+=p.length,r+=this._removeEmptyFeatures(p,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!f,s=s?.concat(p)??p,h=Z(h,_),u=V(u,m),e.setFeatures(s,r,h,u),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()},t),n(t),o=this._maximumFeaturesForTile(e)-(s?.length??0),!c||!f||o<=0)return f?4:5}}_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();return t.resultType=this._resultType(e),!N(e)&&e.descriptor.extent&&this.context.tilingScheme&&(t.geometry=T(e.descriptor.extent,this.context.tilingScheme.spatialReference)),this._setResolutionParams(t,e),"tile"!==t.resultType&&this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),S(e)&&this.context.highlightIds?.length?t.objectIds=this.context.highlightIds:!Q(e)&&this.context.effectiveDisplayFilter&&(t.where=c(t.where,this.context.effectiveDisplayFilter.where)),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(N(e)||!this._supportsResolution)return null;const t=1===this.context.viewingMode&&this.context.tilingScheme?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&"point"!==this.context.geometryType}_setResolutionParams(e,t){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,t){const i=e.length;if(t&&this._supportsResolution){const i=t*(1+_());s(e,({geometry:e})=>!(!e||!b(e))&&(E(e,X),x(X)>i||v(X)>i))}else s(e,({geometry:e})=>b(e));return i-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!Q(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case"tile":if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case"standard":if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||$}_resultType(e){if(this.context.capabilities.supportsResultType)return Q(e)?"standard":"tile"}get _reduceMode(){const e=this.context.geometryType;return"polygon"===e||"polyline"===e?0:1}_handleRequest(e,t,s,i,r){e.startFetch(),e.requestController=s;let n=!1;t.then(t=>{e.requestController=null,i(t)}).catch(t=>{e.requestController===s&&(e.requestController=null,e.fetchDone(4)),a(t)?n=!0:r(t)}).then(()=>{n||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.hasHandles("scheduleUpdated")||this.addHandles(h(()=>{this.removeHandles("scheduleUpdated"),this._updated()}),"scheduleUpdated")}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;const t=e.features;if(0===e.featureLimit||!t){const t=null!=e.displayingFeatures&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}const s=e.fetchingResolution,{adds:i,updates:r}=this._changes,a=Math.min(e.featureLimit,t.length);for(let n=0;n<a;++n){const e=t[n],a=R(e,this._objectIdField),o=this._displayingFeatureReferences.get(a);if(o){const{oldVersion:t,newVersion:i}=o.ref(e,s);t!==i&&(t&&r.removes.push(t),i&&r.adds.push(i))}else this._displayingFeatureReferences.set(a,new this.FeatureReferenceClass(e,s)),i.push(e);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(null==e.displayingFeatures)return;const{updates:t,removes:s}=this._changes;for(const i of e.displayingFeatures){const r=R(i,this._objectIdField),a=this._displayingFeatureReferences.get(r);if(!a)continue;const{oldVersion:n,newVersion:o}=a.unref(e.displayingResolution);this._numDisplayingFeatureReferences--,n!==o&&(null==o?(this._displayingFeatureReferences.delete(r),n&&s.push(n)):(t.adds.push(o),n&&t.removes.push(n)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get("dataUpdating")||this._set("dataUpdating",!0)}_applyChanges(){const e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),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+K,i);this._notifyDataUpdating(),this.features.addMany(t.slice(r,e)),this.features.removeMany(s.slice(r,e)),r=e}t.length>i&&(this._notifyDataUpdating(),this.features.addMany(0===r?t:t.slice(r))),s.length>i&&(this._notifyDataUpdating(),this.features.removeMany(0===r?s:s.slice(r))),t.length=0,s.length=0}_clearTile(e){this._hideTile(e),e.features&&null!=this.context.memoryCache&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange("totalVertices"),this.notifyChange("totalFeatures"),this.notifyChange("memoryForUnusedFeatures")}get _featureTilesArray(){return Array.from(this._featureTiles.values())}get featureTiles(){return this._featureTiles}get storedFeatures(){return this._featureTilesArray.reduce((e,t)=>e+(t.features?t.features.length:0),0)}get missingTiles(){return Array.from(this._featureTiles.values()).reduce((e,t)=>e+(t.needsFetch||t.isFetching?1:0),0)}_totalFeaturesForTile(e){return e.hasPreciseFeatureCount?e.numFeatures:this.maximumNumberOfFeatures}_maximumFeaturesForTile(e){const t=this._totalFeaturesForTile(e),s=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(t*s/(1-e.emptyFeatureRatio)),t)}get test(){}};function Q(e){return e.id===I}function S(e){return e.id===A}function N(e){return Q(e)||S(e)}function L(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 k(e){e.setFeatures([],0,null,void 0)}function H(e){return null==e?new Set:new Set(e.map(e=>e.name))}function Z(e,t){if(null==e||null==t)return H(t);const s=new Set;for(const{name:i}of t)e.has(i)&&s.add(i);return s}function V(e,t){if(!t?.length)return e;e??=new Map;const s=()=>new Set;for(const{objectId:i,attribute:a}of t)r(e,i,s).add(a);return e}e([p({constructOnly:!0})],q.prototype,"features",void 0),e([p()],q.prototype,"tileDescriptors",void 0),e([p({value:1/0})],q.prototype,"maximumNumberOfFeatures",null),e([p({value:1})],q.prototype,"memoryFactor",null),e([p({value:1})],q.prototype,"lodFactor",null),e([p()],q.prototype,"useTileCount",null),e([p({readOnly:!0})],q.prototype,"updating",null),e([p({readOnly:!0})],q.prototype,"dataUpdating",void 0),e([p({readOnly:!0})],q.prototype,"updatingTotal",void 0),e([p({readOnly:!0})],q.prototype,"updatingRemaining",void 0),e([p({readOnly:!0})],q.prototype,"expectedFeatureDiff",void 0),e([p({readOnly:!0})],q.prototype,"memoryForUnusedFeatures",null),e([p({readOnly:!0})],q.prototype,"maximumNumberOfFeaturesExceeded",void 0),e([p({readOnly:!0})],q.prototype,"totalVertices",null),e([p({readOnly:!0})],q.prototype,"totalFeatures",null),e([p({readOnly:!0})],q.prototype,"showsAllFeatures",null),e([p({readOnly:!0})],q.prototype,"hasFullGeometries",null),e([p()],q.prototype,"filterExtent",null),e([p({constructOnly:!0})],q.prototype,"context",void 0),e([p()],q.prototype,"_dirty",void 0),e([p()],q.prototype,"_suspended",void 0),e([p()],q.prototype,"_pendingEdits",void 0),e([p()],q.prototype,"_applyEditsTilesUpdated",void 0),e([p()],q.prototype,"_paused",null),e([p()],q.prototype,"_isFetching",void 0),q=e([f("esri.views.3d.layers.support.FeatureTileFetcher3D")],q);const $=2e3,B=m(),G=m(),X=m(),J=6e5,K=200;export{q as FeatureTileFetcher3D};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{filterInPlace as s}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{getOrCreateMapValue as r}from"../../../../core/MapUtils.js";import{isAbortError as a,throwIfAborted as n}from"../../../../core/promiseUtils.js";import o from"../../../../core/ReactiveMap.js";import{on as l,watch as u}from"../../../../core/reactiveUtils.js";import{schedule as h}from"../../../../core/scheduling.js";import{signal as d}from"../../../../core/signal.js";import{sqlAnd as c}from"../../../../core/sql.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{getEpsilon as _}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as m,equals as g,clone as y,expand as F,toExtent as T,width as x,height as v}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as R,hasVertices as b,computeAABR as E}from"../../../../layers/graphics/dehydratedFeatures.js";import C from"../../../../rest/support/QuantizationParameters.js";import D from"../../../../rest/support/Query.js";import{MultiFeatureReference as w,SingleFeatureReference as M}from"./featureReference.js";import{failedFeatureCount as U,FeatureTile as j}from"./FeatureTile.js";import{virtualDisplayFilterHighlightTileId as A,virtualSnapshotTileId as I}from"./FeatureTileDescriptor.js";import{tilesAreRelated as O}from"../../terrain/tileUtils.js";import{ImmediateTask as P,TaskPriority as z}from"../../../support/Scheduler.js";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&&null!=this.context.query.queryFeatureCount}set useTileCount(e){this._useTileCount=e,this.notifyChange("useTileCount")}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get readyToRun(){return this._dirty}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}get showsAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(const e of this._featureTiles.values())if(!this.hasFullGeometries&&0!==e.emptyFeatureRatio||!e.showsAllFeatures)return!1;return!0}get hasFullGeometries(){if(!this._supportsResolution)return!0;const e=this.tileDescriptors?.some(Q);return e||!this.context.capabilities.supportsQuantization&&"polyline"!==this.context.geometryType}set filterExtent(e){if(null!=e&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference))return void i.getLogger(this).error("#filterExtent=","extent needs to be in the same spatial reference as the tiling scheme");const t=this._get("filterExtent");if(t===e||null!=t&&e&&t.equals(e))return;const s=null!=e?e.clone():null;this._set("filterExtent",s),this._reclip(s,t)}_updateTileZQuantization(e){if(1===this.context.viewingMode){const t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=d(1),this._changes={updates:{adds:new Array,removes:new Array},adds:new Array,removes:new Array},this._featureTiles=new o,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this._isFetching=!1;const t=e.context;this._frameTask=t.scheduler?.registerTask(z.FEATURE_TILE_FETCHER,this)??P,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?w:M,this._objectIdField=t.objectIdField}initialize(){this.addHandles([l(()=>this.tileDescriptors,"change",()=>this._setDirty(),{onListenerAdd:()=>this._setDirty(),onListenerRemove:()=>this._setDirty()}),u(()=>this._tileZQuantization,()=>this.refetch())]),this._setDirty()}destroy(){this._frameTask.remove(),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)}),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._setDirty()}refetchDisplayFilterHighlightTile(){const e=this._featureTiles.get(A);e&&(this._cancelFetchTile(e),this._resetFetchTile(e),this._setDirty())}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(const t of this._featureTiles.values()){const s=t.missingAttributes?.get(e);if(null!=s)return s}}_pause(){this._paused&&(this._featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach(t=>{null!=t.displayingFeatures&&0!==t.displayingFeatures.length&&(null==e?e=new Set(t.availableFields):e.forEach(s=>{t.availableFields?.has(s)||e.delete(s)}))}),null!=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(a(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),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),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),r=new Set,a=this._objectIdField;e.forEach(({objectId:e,globalId:n})=>{(!e||e<0)&&t&&n&&(s||i.getLogger(this).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`),e=this._objectIdFromGlobalId(n,a,t)),null!=e&&e>=0&&r.add(e)}),this._featureTiles.forEach(e=>{if(!e.features)return;const t=e.features.filter(e=>!r.has(R(e,this._objectIdField)));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())})}_objectIdFromGlobalId(e,t,s){if(null==e)return null;const i=this.features.find(t=>t.attributes?.[s]===e);return i?R(i,t):null}async _applyEditsAddUpdateFeatures(e,t,s){const{objectIdField:r,globalIdField:a}=this.context,n=a&&this.availableFields.has(a),o=new Set,l=new Set;for(const i of e){const e=i.objectId;null!=e&&o.add(e)}for(const{objectId:h,globalId:d}of t){let e=h;(null==e||e<0)&&a&&(n||i.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(d,r,a)),null!=e&&e>=0&&(o.add(e),l.add(e))}if(0===o.size)return;const u=[];this._featureTiles.forEach(e=>{const t=this._applyEditsAddUpdateTile(e,o,l,s);u.push(t)}),this._updated(),await Promise.allSettled(u)}async _applyEditsAddUpdateTile(e,t,s,i){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;const r=this._createQuery(e);r.resultType=void 0,r.cacheHint=!1,r.objectIds=Array.from(t);const a=await this._queryFeatures(r,i);let n=null;if(s.size>0){const t=e.features.filter(e=>!s.has(R(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)),this._applyEditsTileUpdated(),e.setFeatures(n,0,Z(e.availableFields,a.fields),V(e.missingAttributes,a.missingAttributes)),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t){return this.context.query.queryFeaturesDehydrated(e,{signal:t,timeout:J})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){const t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;const s=this._featureTilesArray;if(this._markTilesNotAlive(s),!e.run(()=>this._addTiles(s,e))||!e.run(()=>this._filterExtentTiles(s,e))||!e.run(()=>this._removeTiles(s,e))||e.done)return void this._setDirty();const i=this._sortTiles(s);e.run(()=>this._showTiles(i,e))&&e.run(()=>this._fetchTiles(i,e))&&e.run(()=>this._updateMemoryEstimates(i,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)&&(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}_showTiles(e,t){const s=this._updateRatio(e),i=e=>{const t=this._fullRatio<1?s(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();const{numFeatures:i,fetchingResolution:r,descriptor:a,isFetched:n}=e;return this._supportsResolution&&i>0&&r!==a.resolution&&n&&(e.requestRefetch(),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.needsFetch)continue;const e=null!=this.context.memoryCache?this.context.memoryCache.pop(i.id):null;if(e?.resolution!==i.displayingResolution){if(this._needsNumFeatures(i)){const e=new AbortController,r=this._fetchTileCount(i,e.signal);this._handleRequest(i,r,e,()=>i.resetFetching(),()=>i.numFeatures=U),s=!0,t.madeProgress()}if(t.done)return!0}else i.cache=e,i.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress()}if(s)return t.hasProgressed;for(const r of e){if(!r.needsFetch)continue;const e=new AbortController,s=this._fetchTile(r,e.signal);if(this._handleRequest(r,s,e,e=>r.fetchDone(e),e=>{r.fetchFailed=!0,this.context.logFetchError(i.getLogger(this),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=>{null!=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(null!=i.displayingFeatures)for(const e of i.displayingFeatures){const i=R(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;if(this._paused||this._featureTiles.forEach(t=>t.isFetching?++e:0),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set("dataUpdating",!1),this.updating){let t=0,s=0,i=0,r=0,a=0;const n=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach(e=>{if(++s,e.isFetching&&e.hasPreciseFeatureCount){const t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),s=null!=e.displayingFeatures?e.displayingFeatures.length*n:0;a+=t-s}e.needsFetch?++r:e.numFeatures>0&&(++i,t+=e.numFeatures)}),r+=e;let o=0,l=0;t?(l=t,o=Math.min(r*t/i,t)):(l=s,o=r),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set("updatingTotal",l),this._set("updatingRemaining",o),this._set("expectedFeatureDiff",a)}else this._set("updatingTotal",0),this._set("updatingRemaining",0),this._set("expectedFeatureDiff",0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(const{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e)return void this._set("maximumNumberOfFeaturesExceeded",!0);this._set("maximumNumberOfFeaturesExceeded",!1)}_updateRatio(e){const t=L(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.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))}),this._setDirty())}_addTile(e){const t=new j(e);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){const t=e.displayingResolution;this._featureTiles.forEach(s=>{if(null!=s.displayingFeatures&&e!==s&&O(e.descriptor.lij,s.descriptor.lij)){null==e.displayingFeatures&&(e.displayingFeatures=[]),e.descriptor.extent&&s.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=y(e.descriptor.extent),F(e.extentIncludingBorrowedFeatures,s.descriptor.extent,e.extentIncludingBorrowedFeatures));for(const i of s.displayingFeatures){e.displayingFeatures.push(i);const s=this._displayingFeatureReferences.get(R(i,this._objectIdField));s.ref(s.feature,t),this._numDisplayingFeatureReferences++}}})}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(4):e.requestFetch()}_cancelFetchTile(e){const t=e.requestController;null!=t&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this._fetchCount(e,t),this._updateRatio(this._featureTilesArray)}async _fetchTile(e,t){e.fetchFailed=!1;const s=this._maximumFeaturesForTile(e);if(s<=0)return e.hasPreciseFeatureCount&&0===e.numFeatures||(e.fetchFailed=!0),k(e),e.fetchInformation.value="Empty tile",4;const i=this._getMaxRecordCount(e),r=Math.ceil(s/i);if(e.fetchingResolution=e.descriptor.resolution,N(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=s&&r>D.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);const a=this._createQuery(e);if(a.maxRecordCountFactor=r,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)}e.fetchInformation.value=`Single fetch\n${s} features`;const{features:o,exceededTransferLimit:l,fields:u,missingAttributes:h}=await this._queryFeatures(a,t),d=l||a.maxRecordCountFactor>=D.MAX_MAX_RECORD_COUNT_FACTOR||s===this._totalFeaturesForTile(e)?5:4,c=await this._frameTask.schedule(()=>{e.exceededTransferLimit.value=!!l;const t=this._removeEmptyFeatures(o,this._getEffectiveTileResolution(e));return e.fetchInformation.value=`Single fetch\n${o.length}/${s} features`,e.setFeatures(o,t,H(u),V(void 0,h)),this._updateTileZQuantization(e),this._maximumFeaturesForTile(e)>s?1:d},t);return n(t),this._invalidateCounts(),c}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,o=this._maximumFeaturesForTile(e)-a;const l=this._getMaxRecordCount(e);let u,h=null;for(;;){const d=this._createQuery(e),c=this._setPagingParameters(d,i,o,l);e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${o} features`;const{features:p,exceededTransferLimit:f,fields:_,missingAttributes:m}=await this._queryFeatures(d,t);if(await this._frameTask.schedule(()=>{c&&(i+=d.num),a+=p.length,r+=this._removeEmptyFeatures(p,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!f,s=s?.concat(p)??p,h=Z(h,_),u=V(u,m),e.setFeatures(s,r,h,u),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()},t),n(t),o=this._maximumFeaturesForTile(e)-(s?.length??0),!c||!f||o<=0)return f?4:5}}_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();if(t.resultType=this._resultType(e),!N(e)&&e.descriptor.extent&&this.context.tilingScheme&&(t.geometry=T(e.descriptor.extent,this.context.tilingScheme.spatialReference)),this._setResolutionParams(t,e),"tile"!==t.resultType&&this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),S(e)){const{highlightIds:e}=this.context;e&&e.length>$&&i.getLogger(this).warn("highlight-too-many-features",`highlight is limited to ${$} features on large layers configured with a display filter to avoid performance issues`),t.objectIds=e?.slice(0,$)}else!Q(e)&&this.context.effectiveDisplayFilter&&(t.where=c(t.where,this.context.effectiveDisplayFilter.where));return 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(N(e)||!this._supportsResolution)return null;const t=1===this.context.viewingMode&&this.context.tilingScheme?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&"point"!==this.context.geometryType}_setResolutionParams(e,t){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,t){const i=e.length;if(t&&this._supportsResolution){const i=t*(1+_());s(e,({geometry:e})=>!(!e||!b(e))&&(E(e,X),x(X)>i||v(X)>i))}else s(e,({geometry:e})=>b(e));return i-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!Q(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case"tile":if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case"standard":if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||$}_resultType(e){if(this.context.capabilities.supportsResultType)return Q(e)?"standard":"tile"}get _reduceMode(){const e=this.context.geometryType;return"polygon"===e||"polyline"===e?0:1}_handleRequest(e,t,s,i,r){e.startFetch(),e.requestController=s;let n=!1;t.then(t=>{e.requestController=null,i(t)}).catch(t=>{e.requestController===s&&(e.requestController=null,e.fetchDone(4)),a(t)?n=!0:r(t)}).then(()=>{n||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.hasHandles("scheduleUpdated")||this.addHandles(h(()=>{this.removeHandles("scheduleUpdated"),this._updated()}),"scheduleUpdated")}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;const t=e.features;if(0===e.featureLimit||!t){const t=null!=e.displayingFeatures&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}const s=e.fetchingResolution,{adds:i,updates:r}=this._changes,a=Math.min(e.featureLimit,t.length);for(let n=0;n<a;++n){const e=t[n],a=R(e,this._objectIdField),o=this._displayingFeatureReferences.get(a);if(o){const{oldVersion:t,newVersion:i}=o.ref(e,s);t!==i&&(t&&r.removes.push(t),i&&r.adds.push(i))}else this._displayingFeatureReferences.set(a,new this.FeatureReferenceClass(e,s)),i.push(e);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(null==e.displayingFeatures)return;const{updates:t,removes:s}=this._changes;for(const i of e.displayingFeatures){const r=R(i,this._objectIdField),a=this._displayingFeatureReferences.get(r);if(!a)continue;const{oldVersion:n,newVersion:o}=a.unref(e.displayingResolution);this._numDisplayingFeatureReferences--,n!==o&&(null==o?(this._displayingFeatureReferences.delete(r),n&&s.push(n)):(t.adds.push(o),n&&t.removes.push(n)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get("dataUpdating")||this._set("dataUpdating",!0)}_applyChanges(){const e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),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+K,i);this._notifyDataUpdating(),this.features.addMany(t.slice(r,e)),this.features.removeMany(s.slice(r,e)),r=e}t.length>i&&(this._notifyDataUpdating(),this.features.addMany(0===r?t:t.slice(r))),s.length>i&&(this._notifyDataUpdating(),this.features.removeMany(0===r?s:s.slice(r))),t.length=0,s.length=0}_clearTile(e){this._hideTile(e),e.features&&null!=this.context.memoryCache&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange("totalVertices"),this.notifyChange("totalFeatures"),this.notifyChange("memoryForUnusedFeatures")}get _featureTilesArray(){return Array.from(this._featureTiles.values())}get featureTiles(){return this._featureTiles}get storedFeatures(){return this._featureTilesArray.reduce((e,t)=>e+(t.features?t.features.length:0),0)}get missingTiles(){return Array.from(this._featureTiles.values()).reduce((e,t)=>e+(t.needsFetch||t.isFetching?1:0),0)}_totalFeaturesForTile(e){return e.hasPreciseFeatureCount?e.numFeatures:this.maximumNumberOfFeatures}_maximumFeaturesForTile(e){const t=this._totalFeaturesForTile(e),s=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(t*s/(1-e.emptyFeatureRatio)),t)}get test(){}};function Q(e){return e.id===I}function S(e){return e.id===A}function N(e){return Q(e)||S(e)}function L(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 k(e){e.setFeatures([],0,null,void 0)}function H(e){return null==e?new Set:new Set(e.map(e=>e.name))}function Z(e,t){if(null==e||null==t)return H(t);const s=new Set;for(const{name:i}of t)e.has(i)&&s.add(i);return s}function V(e,t){if(!t?.length)return e;e??=new Map;const s=()=>new Set;for(const{objectId:i,attribute:a}of t)r(e,i,s).add(a);return e}e([p({constructOnly:!0})],q.prototype,"features",void 0),e([p()],q.prototype,"tileDescriptors",void 0),e([p({value:1/0})],q.prototype,"maximumNumberOfFeatures",null),e([p({value:1})],q.prototype,"memoryFactor",null),e([p({value:1})],q.prototype,"lodFactor",null),e([p()],q.prototype,"useTileCount",null),e([p({readOnly:!0})],q.prototype,"updating",null),e([p({readOnly:!0})],q.prototype,"dataUpdating",void 0),e([p({readOnly:!0})],q.prototype,"updatingTotal",void 0),e([p({readOnly:!0})],q.prototype,"updatingRemaining",void 0),e([p({readOnly:!0})],q.prototype,"expectedFeatureDiff",void 0),e([p({readOnly:!0})],q.prototype,"memoryForUnusedFeatures",null),e([p({readOnly:!0})],q.prototype,"maximumNumberOfFeaturesExceeded",void 0),e([p({readOnly:!0})],q.prototype,"totalVertices",null),e([p({readOnly:!0})],q.prototype,"totalFeatures",null),e([p({readOnly:!0})],q.prototype,"showsAllFeatures",null),e([p({readOnly:!0})],q.prototype,"hasFullGeometries",null),e([p()],q.prototype,"filterExtent",null),e([p({constructOnly:!0})],q.prototype,"context",void 0),e([p()],q.prototype,"_dirty",void 0),e([p()],q.prototype,"_suspended",void 0),e([p()],q.prototype,"_pendingEdits",void 0),e([p()],q.prototype,"_applyEditsTilesUpdated",void 0),e([p()],q.prototype,"_paused",null),e([p()],q.prototype,"_isFetching",void 0),q=e([f("esri.views.3d.layers.support.FeatureTileFetcher3D")],q);const $=2e3,B=m(),G=m(),X=m(),J=6e5,K=200;export{q as FeatureTileFetcher3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import i from"../../../../core/Logger.js";import{removeMaybe as r,destroyMaybe as s}from"../../../../core/maybe.js";import{throwIfNotAbortError as o,throwIfAborted as l,throwIfAbortError as n}from"../../../../core/promiseUtils.js";import{initial as a}from"../../../../core/reactiveUtils.js";import{sqlAnd as u}from"../../../../core/sql.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as c}from"../../../../core/support/UpdatingHandles.js";import g from"../../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as _}from"../../../../layers/support/floorFilterUtils.js";import{QueryEngine as d}from"../graphics/QueryEngine.js";import{QueryEngineContext as f}from"../graphics/QueryEngineContext.js";import{TaskPriority as y}from"../../../support/Scheduler.js";let m=class extends e{constructor(t){super(t),this._frameTask=null,this._queryEngine=null,this._updateRequested=!0,this._updatingHandles=new c,this._abortController=new AbortController}initialize(){const t=y.FILTER_VISIBILITY,{layer:e,view:i}=this._configuration,{featureStore:r}=this.context,{spatialReference:s,resourceController:l}=i,n=this._configuration.hasZ??!1,u=this._configuration.hasM??!1,h=new f(s,e,l,()=>r,n,u);this._queryEngine=new d({context:h,priority:t}),this._frameTask=i.resourceController.scheduler.registerTask(t),this._updatingHandles.add(()=>[this._compositedFeatureFilter,this._sceneFilter,this._displayFilterHighlightIds],()=>this.reapply(),a),this._updatingHandles.addWhen(()=>!this._frameTask.updating&&this._updateRequested,()=>{this._frameTask.scheduleGenerator(()=>this._updateVisibility(),this._abortController.signal).catch(o)},a)}destroy(){this._abortController.abort(),this._updatingHandles.destroy(),this.clear(),this._frameTask=r(this._frameTask),this._queryEngine=s(this._queryEngine),this._set("context",null)}get updating(){return this._updateRequested||this._updatingHandles.updating||this._frameTask.updating}get defaultVisibility(){return null==this._compositedFeatureFilter&&null==this._sceneFilter}get _featureFilter(){return"filter"in this._configuration?this._configuration.filter:null}get _effectiveDisplayFilter(){return"effectiveDisplayFilter"in this._configuration?this._configuration.effectiveDisplayFilter:null}get _highlightIds(){return"highlightIds"in this._configuration?this._configuration.highlightIds:null}get _displayFilterHighlightIds(){return this._effectiveDisplayFilter&&this._highlightIds?.length?new Set(this._highlightIds):null}get _sceneFilter(){return"layerFilter"in this._configuration?this._configuration.layerFilter:null}get _floorFilter(){return _(this._configuration)}get _timeExtent(){return"timeExtent"in this._configuration?this._configuration.timeExtent:null}get _compositedFeatureFilter(){const{_featureFilter:t,_effectiveDisplayFilter:e,_timeExtent:i,_floorFilter:r}=this;let s=t?.clone();if(null!=e&&(s??=new g,s.where=u(s.where,e.where)),null!=i&&(s??=new g,s.timeExtent=s.timeExtent?.intersection(i)??i),null!=r){s??=new g;const t=null==s.where||""===s.where;s.where=t?r:u(s.where,r)}return s}get _configuration(){return this.context.configuration}reapply(){this._updateRequested=!0}clear(){this._queryEngine.clear(),this.context.clearFeaturesVisibility()}async*_updateVisibility(){this._updateRequested=!1;const{context:t,_sceneFilter:e,_compositedFeatureFilter:r,_displayFilterHighlightIds:s,_abortController:{signal:o}}=this;if(l(o),null==r&&null==e||0===t.getFeatureCount())return this.clear();try{let i=await this._queryEngine.executeQueryForIdSet(r,e,o);yield,s&&(i=new Set([...i,...s])),yield,t.updateFeatureVisibilities(t=>i.has(t))}catch(a){n(a),i.getLogger(this).warn(`FeatureFilter query failed: ${a}`,{error:a}),t.setAllFeaturesVisibility(!0)}}};t([h({constructOnly:!0})],m.prototype,"context",void 0),t([h()],m.prototype,"updating",null),t([h()],m.prototype,"defaultVisibility",null),t([h()],m.prototype,"_featureFilter",null),t([h()],m.prototype,"_effectiveDisplayFilter",null),t([h()],m.prototype,"_highlightIds",null),t([h()],m.prototype,"_displayFilterHighlightIds",null),t([h()],m.prototype,"_sceneFilter",null),t([h()],m.prototype,"_floorFilter",null),t([h()],m.prototype,"_timeExtent",null),t([h()],m.prototype,"_compositedFeatureFilter",null),t([h()],m.prototype,"_configuration",null),t([h()],m.prototype,"_updateRequested",void 0),m=t([p("esri.views.3d.layers.support.FeatureVisibilityFilter")],m);export{m as FeatureVisibilityFilter};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{F as FocusAreaColorPassParameters,b as build}from"../../../../../chunks/FocusAreaColor.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as o}from"../../../webgl.js";import t from"../../../webgl/RenderNode.js";import{
|
|
5
|
+
import{__decorate as e}from"tslib";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as o}from"../../../webgl.js";import t from"../../../webgl/RenderNode.js";import{F as i}from"../../../../../chunks/FocusAreaColor.glsl.js";import{FocusAreaColorTechnique as c}from"./FocusAreaColorTechnique.js";import{DepthStencilAttachment as a}from"../../../../webgl/enums.js";let p=class extends t{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[o.FOCUSAREA_COLOR,o.FOCUSAREA]},this.produces=o.FOCUSAREA_COLOR,this._passParameters=new i}precompile(){this.techniques.precompile(c)}render(e){const r=this.techniques.get(c),s=e.find(({name:e})=>e===this.produces);if(!r.compiled)return this.requestRender(),s;const t=this.focusAreasView.style,i=this.bindParameters,p=i.camera,n=p.fullViewport[2],u=p.fullViewport[3],d=e.find(({name:e})=>e===o.FOCUSAREA),h=this.fboCache.acquire(n,u,this.produces),f=this.renderingContext;return f.bindFramebuffer(h.fbo),this._passParameters.color=s.getTexture(),this._passParameters.focusArea=d.getTexture(),this._passParameters.effect=m[t],f.bindTechnique(r,i,this._passParameters),f.screen.draw(),h.attachDepth(s.getAttachment(a)),h}};e([r()],p.prototype,"consumes",void 0),e([r()],p.prototype,"produces",void 0),e([r({constructOnly:!0})],p.prototype,"focusAreasView",void 0),p=e([s("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaColorNode")],p);const m={bright:0,dark:1};export{p as FocusAreaColorNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{
|
|
5
|
+
import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as o}from"../../../../../chunks/FocusAreaColor.glsl.js";import{Pos2Locations as s}from"../../lib/DefaultVertexBufferLayouts.js";import{makePipelineState as t,defaultColorWrite as i}from"../../../../webgl/renderState.js";class l extends r{constructor(r,t){super(r,t,new e(o,()=>import("./FocusAreaColor.glsl.js")),s)}initializePipeline(){return t({colorWrite:i})}}export{l as FocusAreaColorTechnique};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import"../../../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Matrix4BindUniform.js";import"../../core/shaderModules/Matrix4DrawUniform.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{F as FocusAreaMaskDrawParameters,b as build}from"../../../../../chunks/FocusAreaMask.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as t}from"../../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as r,InternalRenderCategory as o}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{
|
|
5
|
+
import{__decorate as e}from"tslib";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as t}from"../../../../../core/accessorSupport/decorators/subclass.js";import{RenderCategory as r,InternalRenderCategory as o}from"../../../webgl.js";import i from"../../../webgl/RenderNode.js";import{F as n}from"../../../../../chunks/FocusAreaMask.glsl.js";import{FocusAreaMaskTechnique as a}from"./FocusAreaMaskTechnique.js";import{Pos3 as c}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as h}from"../../lib/VertexArrayObject.js";import{DepthStencilAttachment as p,PrimitiveType as l}from"../../../../webgl/enums.js";import{noParameters as u}from"../../../../webgl/NoParameters.js";import{VertexBuffer as m}from"../../../../webgl/VertexBuffer.js";let d=class extends i{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[r.TRANSPARENT]},this.produces=o.FOCUSAREA,this._vaos=new Array,this._counts=new Array,this._origins=new Array,this._maskParameters=new n}initialize(){this.updateGeometries()}destroy(){this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0}precompile(){this.techniques.precompile(a)}render(e){const s=this.techniques.get(a),t=this.bindParameters,i=t.camera,n=i.fullViewport[2],c=i.fullViewport[3];if(!s.compiled||!this._vaos)return void this.requestRender();const h=e.find(({name:e})=>e===r.TRANSPARENT),m=this.renderingContext,d=this.fboCache.acquire(n,c,o.FOCUSAREA,2);this.view.stage.renderer.occludedRequiresStencil?(d.acquireDepth(12),m.blitFramebuffer(h.fbo,d.fbo,256)):d.attachDepth(h.getAttachment(p)),m.bindFramebuffer(d.fbo),m.setClearColor(0,0,0,1),m.clear(17408),m.setViewport(0,0,n,c);const f=m.bindTechnique(s,t);m.setFaceCullingEnabled(!1),m.setStencilTestEnabled(!0),m.setStencilOpSeparate(1028,7680,34055,7680),m.setStencilOpSeparate(1029,7680,34056,7680),m.setDepthWriteEnabled(!1);for(let r=0;r<this._vaos.length;r++){const e=this._vaos[r],s=this._counts[r];this._maskParameters.origin=this._origins[r],f.bindDraw(t,u,this._maskParameters),m.bindVAO(e),m.setDepthTestEnabled(!0),m.setStencilWriteMask(255),m.setStencilFunction(519,0,255),m.setColorMask(!1,!1,!1,!1),m.drawArrays(l.TRIANGLES,0,s),m.setDepthTestEnabled(!1),m.setStencilWriteMask(0),m.setStencilFunction(517,0,255),m.setColorMask(!0,!0,!0,!0),m.drawArrays(l.TRIANGLES,0,s)}return d}updateGeometries(){if(!this.view.stage)return;this._vaos.forEach(e=>e.dispose()),this._vaos.length=this._counts.length=this._origins.length=0;this.focusAreasView.volumes.forEach(e=>{const s=new Array;let t=0,r=0;e.geometryVolumes.forEach(e=>{const o=e.indicesBottom;t+=o.length;for(let t=0;t<o.length;t++)s.push(e.positions[3*(o[t]-1)]),s.push(e.positions[3*(o[t]-1)+1]),s.push(e.positions[3*(o[t]-1)+2]);const i=e.indicesExtruded;r+=i.length;for(let t=0;t<i.length;t++)s.push(e.positions[3*i[t]]),s.push(e.positions[3*i[t]+1]),s.push(e.positions[3*i[t]+2])});const o=new h(this.renderingContext,new m(this.renderingContext,c,new Float32Array(s)));this._vaos.push(o),this._counts.push(t+r),this._origins.push(e.origin)}),this.requestRender()}};e([s()],d.prototype,"consumes",void 0),e([s()],d.prototype,"produces",void 0),e([s({constructOnly:!0})],d.prototype,"focusAreasView",void 0),d=e([t("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaMaskNode")],d);export{d as FocusAreaMaskNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{
|
|
5
|
+
import{ReloadableShaderModule as e}from"../../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as o}from"../../../../../chunks/FocusAreaMask.glsl.js";import{Pos3 as t}from"../../lib/DefaultVertexBufferLayouts.js";import{makePipelineState as s,defaultColorWrite as i}from"../../../../webgl/renderState.js";import{fromLayout as a}from"../../../../webgl/VertexAttributeLocations.js";class l extends r{constructor(r,s){super(r,s,new e(o,()=>import("./FocusAreaMask.glsl.js")),a(t))}initializePipeline(){return s({colorWrite:i,depthTest:{func:515}})}}export{l as FocusAreaMaskTechnique};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../../Color.js";import o from"../../../../../core/Accessor.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{watch as s,initial as i}from"../../../../../core/reactiveUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{OutlineVisualElement as a}from"../../../interactive/visualElements/OutlineVisualElement.js";let m=class extends o{constructor(e){super(e)}initialize(){this.addHandles([s(()=>this.area.enabled,()=>this._ensureElement(),i),s(()=>this.area.outline?.color,e=>this._updateColor(e),i),s(()=>this.area.geometries,e=>this._updateGeometries(e),i)])}destroy(){this.removeAllHandles(),this._outlineElement=r(this._outlineElement)}_ensureElement(){this.area.enabled&&this.area.outline?.color?this._outlineElement??=new a({view:this.view,geometry:this._mergePolygons(this.area.geometries),isDraped:!0,attached:!0,isDecoration:!1,color:t.toUnitRGBA(this.area.outline?.color),renderOccluded:4,width:3}):this._outlineElement=r(this._outlineElement)}_updateGeometries(e){this._ensureElement(),this._outlineElement&&(this._outlineElement.geometry=this._mergePolygons(e))}_updateColor(e){this._ensureElement(),this._outlineElement&&e&&(this._outlineElement.color=t.toUnitRGBA(e))}_mergePolygons(e){if(!e||0===e.length)return null;const t=e.at(0).clone();return e.forEach(e=>
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../../Color.js";import o from"../../../../../core/Accessor.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{watch as s,initial as i}from"../../../../../core/reactiveUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{OutlineVisualElement as a}from"../../../interactive/visualElements/OutlineVisualElement.js";let m=class extends o{constructor(e){super(e)}initialize(){this.addHandles([s(()=>this.area.enabled,()=>this._ensureElement(),i),s(()=>this.area.outline?.color,e=>this._updateColor(e),i),s(()=>this.area.geometries,e=>this._updateGeometries(e),i)])}destroy(){this.removeAllHandles(),this._outlineElement=r(this._outlineElement)}_ensureElement(){this.area.enabled&&this.area.outline?.color?this._outlineElement??=new a({view:this.view,geometry:this._mergePolygons(this.area.geometries),isDraped:!0,attached:!0,isDecoration:!1,color:t.toUnitRGBA(this.area.outline?.color),renderOccluded:4,width:3}):this._outlineElement=r(this._outlineElement)}_updateGeometries(e){this._ensureElement(),this._outlineElement&&(this._outlineElement.geometry=this._mergePolygons(e))}_updateColor(e){this._ensureElement(),this._outlineElement&&e&&(this._outlineElement.color=t.toUnitRGBA(e))}_mergePolygons(e){if(!e||0===e.length)return null;const t=e.at(0).clone();return t.rings.length=0,e.forEach(e=>t.rings.push(...e.rings)),t}};e([n({constructOnly:!0})],m.prototype,"view",void 0),e([n({constructOnly:!0})],m.prototype,"area",void 0),m=e([l("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaOutlineItem")],m);export{m as FocusAreaOutlineItem};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"
|
|
5
|
+
import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/Gamma.glsl.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../shaders/ToneMapping.glsl.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{G as GlowCompositionPassParameters,b as build,d as defaultCompositionParameters}from"../../../../../chunks/GlowComposition.glsl.js";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as i,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as a}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{InternalRenderCategory as n}from"../../../webgl.js";import{TransparentEnvironment as l}from"../TransparentEnvironment.js";import{G as c}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as h}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as u}from"./GlowBlurTechniqueConfiguration.js";import{G as m}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as p}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as d}from"./GlowCompositionTechniqueConfiguration.js";import{blurRadiusPresets as g,lodFactorsPresets as _,normalizePreset as b}from"./GlowPresets.glsl.js";import{ColorAttachment1 as f,DepthStencilAttachment as w}from"../../../../webgl/enums.js";let P=class extends l{constructor(e){super(e),this.consumes={required:[n.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=n.TRANSPARENT_ENVIRONMENT,this._blurHorizontalConfiguration=new u,this._blurVerticalConfiguration=new u,this._compositionConfiguration=new d,this._compositionParameters=new m,this._blurParameters=new c,this._blurScale=3.06,this._blurLodCombination=0,this._glowEnabled=!1,this._glowResults=new Array;e.view.stage.renderView.techniques.precompile(p,this._compositionConfiguration)}initialize(){this.addHandles([i(()=>this._updateFogParameters(),()=>{},r),i(()=>this.view.qualitySettings.glow,e=>{this._glowEnabled=e,this.precompile(),this.requestRender(1)},r)])}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=g[e.type];else{const i="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(g.cloudy,g[e.type],i)}this._computeLodFactors(),this.requestRender(1)}_computeLodFactors(e=_.sunny.presets,i=_.foggy.presets){
|
|
5
|
+
import{__decorate as e}from"tslib";import{lerp as t}from"../../../../../core/mathUtils.js";import{watch as i,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{ZEROS as a}from"../../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import{InternalRenderCategory as n}from"../../../webgl.js";import{TransparentEnvironment as l}from"../TransparentEnvironment.js";import{G as c}from"../../../../../chunks/GlowBlur.glsl.js";import{GlowBlurTechnique as h}from"./GlowBlurTechnique.js";import{GlowBlurTechniqueConfiguration as u}from"./GlowBlurTechniqueConfiguration.js";import{G as m}from"../../../../../chunks/GlowComposition.glsl.js";import{GlowCompositionTechnique as p}from"./GlowCompositionTechnique.js";import{GlowCompositionTechniqueConfiguration as d}from"./GlowCompositionTechniqueConfiguration.js";import{blurRadiusPresets as g,lodFactorsPresets as _,normalizePreset as b}from"./GlowPresets.glsl.js";import{ColorAttachment1 as f,DepthStencilAttachment as w}from"../../../../webgl/enums.js";let P=class extends l{constructor(e){super(e),this.consumes={required:[n.TRANSPARENT_ENVIRONMENT,"emissive"]},this.produces=n.TRANSPARENT_ENVIRONMENT,this._blurHorizontalConfiguration=new u,this._blurVerticalConfiguration=new u,this._compositionConfiguration=new d,this._compositionParameters=new m,this._blurParameters=new c,this._blurScale=3.06,this._blurLodCombination=0,this._glowEnabled=!1,this._glowResults=new Array;e.view.stage.renderView.techniques.precompile(p,this._compositionConfiguration)}initialize(){this.addHandles([i(()=>this._updateFogParameters(),()=>{},r),i(()=>this.view.qualitySettings.glow,e=>{this._glowEnabled=e,this.precompile(),this.requestRender(1)},r)])}_updateFogParameters(){const e=this.view.environment.weather;if("sunny"===e.type||"cloudy"===e.type)this._blurParameters.blurRadius=g[e.type];else{const i="foggy"===e.type?e.fogStrength:e.precipitation;this._blurParameters.blurRadius=t(g.cloudy,g[e.type],i)}this._computeLodFactors(),this.requestRender(1)}_computeLodFactors(e=_.sunny.presets,i=_.foggy.presets){e.forEach((e,r)=>{this._compositionParameters.lodFactors[r]=t(e,i[r],this._blurLodCombination)})}precompile(){this._glowEnabled&&(this.techniques.precompile(h,this._blurHorizontalConfiguration),this._blurVerticalConfiguration.glowStage=1,this.techniques.precompile(h,this._blurVerticalConfiguration)),this._compositionConfiguration.blurEnabled=this._glowEnabled,this.techniques.precompile(p,this._compositionConfiguration)}render(e){const t=e.find(({name:e})=>e===n.TRANSPARENT_ENVIRONMENT),i=t.getAttachment(f)?.attachment;if(!i)return t;const r=t.getAttachment(w);if(!this._glowEnabled){const e=this.techniques.get(p,this._compositionConfiguration);if(!e.compiled)return this.requestRender(1),t;const o=t.getTexture(),s=this.fboCache,{fullWidth:a,fullHeight:n}=this.bindParameters.camera,l=this.renderingContext,c=s.acquire(o.descriptor.width,o.descriptor.height,this.produces);return this._prepareFBO(c,a,n),this._compositionParameters.color=o,this._compositionParameters.emission=i,l.bindTechnique(e,this.bindParameters,this._compositionParameters),l.screen.draw(),c.attachDepth(r),c.attachColor(t.getAttachment(f),f),c}const o=this.techniques.get(h,this._blurHorizontalConfiguration),s=this.techniques.get(h,this._blurVerticalConfiguration),a=this.techniques.get(p,this._compositionConfiguration);if(!o.compiled||!s.compiled||!a.compiled)return this.requestRender(1),t;const l=t.getTexture(),c=this.fboCache,{fullWidth:u,fullHeight:m}=this.bindParameters.camera,d=this.renderingContext;let g=i,_=Math.ceil(u/2),b=Math.ceil(m/2);const P=5,C=this._blurParameters.blurRadius;for(let n=0;n<P;n++){const e=c.acquire(_,b,"glow horizontal",8);this._blurParameters.color=g,this._prepareFBO(e,_,b),d.bindTechnique(o,this.bindParameters,this._blurParameters),d.screen.draw();const t=c.acquire(_,b,"glow vertical",8);this._blurParameters.color=e.getTexture(),this._prepareFBO(t,_,b),d.bindTechnique(s,this.bindParameters,this._blurParameters),d.screen.draw(),e.release(),this._glowResults[n]=t,_=Math.ceil(_/2),b=Math.ceil(b/2),g=this._glowResults[n].getTexture(),this._blurParameters.blurRadius*=this._blurScale}this._blurParameters.blurRadius=C,this._compositionParameters.color=l,this._compositionParameters.emission=i,this._compositionParameters.lodTexture0=this._glowResults[0].getTexture(),this._compositionParameters.lodTexture1=this._glowResults[1].getTexture(),this._compositionParameters.lodTexture2=this._glowResults[2].getTexture(),this._compositionParameters.lodTexture3=this._glowResults[3].getTexture(),this._compositionParameters.lodTexture4=this._glowResults[4].getTexture();const T=c.acquire(l.descriptor.width,l.descriptor.height,this.produces);return T.acquireColor(f,8,"emissive glow"),this._prepareFBO(T,u,m,!0),d.bindTechnique(a,this.bindParameters,this._compositionParameters),d.screen.draw(),this._glowResults.forEach(e=>e.release()),T.attachDepth(r),T}_prepareFBO(e,t,i,r=!1){const o=this.renderingContext;o.bindFramebuffer(e.fbo),o.setViewport(0,0,t,i),o.setClearColor(0,0,0,0),o.clear(16384),r&&o.clearBuffer(1,a)}get test(){return{compositionParameters:this._compositionParameters,blurParameters:this._blurParameters,setBlurLodCombination:e=>{this._blurLodCombination=e,this._computeLodFactors()},setLodFactors:e=>{this._computeLodFactors(b(e))},toggleTonemapping:e=>{this._compositionConfiguration.tonemappingEnabled=e,this.requestRender(1)}}}};e([o()],P.prototype,"consumes",void 0),e([o()],P.prototype,"produces",void 0),P=e([s("esri.views.3d.webgl-engine.effects.glow.GlowRenderNode")],P);export{P as GlowRenderNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as r,filterInPlace as
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as r,filterInPlace as s}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{NestedMap as n}from"../../../../../core/NestedMap.js";import o from"../../../../../core/PooledArray.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{assert as l}from"../../lib/Util.js";import{BufferRange as c,mergeAdjacentRanges as u}from"./BufferRange.js";import{Instance as d}from"./Instance.js";import{PerBufferData as f,hasVao as h}from"./PerBufferData.js";import{PerOriginData as m}from"./PerOriginData.js";import{VaoWriter as p}from"./VaoWriter.js";let g=class extends t{constructor(e){super(e),this._vaoWriter=null,this._useMetalWorkaround=!1,this._hasOccludees=!1}destroy(){this.uninitializeRenderContext()}initializeRenderContext(e){this._useMetalWorkaround=e.renderContext.rctx.isAssumedMetalDriver,this._vaoWriter=new p(this.material,e.renderContext.rctx)}uninitializeRenderContext(){this._useMetalWorkaround=!1,this._vaoWriter=null}get hasOccludees(){return this._hasOccludees}modify(e,t){this._applyUpdates(e,t),this._applyAddsAndRemoves(e),this._updateDrawCommands()}get canCompact(){for(const e of this.dataByOrigin.values())if(e.buffers.some(e=>e.holes.length>1))return!0;return!1}compact(e){if(!this.canCompact)return!1;let t=!1;for(const r of this.dataByOrigin.values()){const s=new Array;for(let t=0;t<r.buffers.length&&!e.done;){const n=r.buffers[t];n.holes.length<=1?++t:(n.instances.forEach(({geometry:e})=>s.push(e)),this._vaoWriter?.deleteBuffer(n.vao),r.buffers[t]=r.buffers[r.buffers.length-1],--r.buffers.length,e.madeProgress())}if(s.length>0){for(r.buffers.forEach(e=>this._applyAdds(e,s));s.length>0;)r.buffers.push(this._applyAndRebuild(new f,s,null));t=!0}}return t}updateHighlights(e){this.highlightOrderMap=e,this.dataByOrigin.forEach(t=>t.buffers.forEach(t=>t.updateHighlights(e)))}_applyUpdates(e,t){const s=this._vaoWriter;if(null!=s)for(const n of e.updates){if(t.done)return;const{renderGeometry:o,updateType:a}=n;r(e.pending.updates,n),t.madeProgress();const i=this.dataByOrigin.get(o.localOrigin.id),l=i?.findBuffer(o.id);if(null==l)return;const c=l.instances.get(o.id);6&a&&s.updateInstance(c,l.vao),25&a&&(l.drawCommandsDirty=!0)}else e.clearUpdates()}_computeDeltas(e,t){const r=new n;for(const s of e){const e=s.localOrigin;if(null==e)continue;let t=r.get(e.id,null);null==t&&(t=new v(e.vec3),r.set(e.id,null,t)),t.changes.push(s)}for(const s of t){const e=s.localOrigin;if(null==e)continue;const t=this.dataByOrigin.get(e.id),n=t?.findBuffer(s.id);if(null==n)continue;let o=r.get(e.id,n);null==o&&(o=new v(e.vec3),r.set(e.id,n,o)),o.changes.push(s)}return r}_applyAddsAndRemoves(e){const{_vaoWriter:t,dataByOrigin:s}=this;if(null==t)return void e.clearAddsAndRemoves();const n=this._computeDeltas(e.adds,e.removes);n.forEach((e,o)=>{const a=e.get(null),i=a?.changes??[];n.delete(o,null);let c=s.get(o);if(e.forEach((e,a)=>{if(n.delete(o,a),null==a&&l(!1,"No VAO for removed geometries"),a.instances.size===e.changes.length)return t.deleteBuffer(a.vao),r(c.buffers,a),void(0===c.buffers.length&&0===i.length&&s.delete(o));const u=a.numElements;switch(t.evaluateBufferAllocation(u,i,e.changes,a.vao)){case 0:e.changes.forEach(({id:e})=>a.deleteInstance(e)),a.instances.forEach(({geometry:e})=>i.push(e)),t.deleteBuffer(a.vao),r(c.buffers,a);break;case 1:this._applyAndRebuild(a,i,e);break;case 2:this._applyRemoves(a,e)}}),i.length>0)for(null==c&&(c=new m(a.origin),s.set(o,c)),c.buffers.forEach(e=>this._applyAdds(e,i));i.length>0;)c.buffers.push(this._applyAndRebuild(new f,i,null))}),e.clearAddsAndRemoves()}_updateDrawCommands(){this._hasOccludees=!1,this.dataByOrigin.forEach(e=>{e.buffers.forEach(e=>{e.updateIfDrawCommandsDirty(this.highlightOrderMap),this._hasOccludees||=e.hasOccludees})})}_applyAndRebuild(e,t,r){if(r)for(const l of r.changes)e.deleteInstance(l.id);const s=this._vaoWriter,n=s.maxElements;let o=e.numElements;for(;t.length>0;){const r=t.pop(),a=s.elementCount(r);if(o+a>n&&o>0){t.push(r);break}o+=a;const i=new d(r,0,0,this.highlightOrderMap);l(null==e.instances.get(r.id)),e.addInstance(r.id,i)}e.resetInstanceSummary(),e.vao=s.reallocateBuffer(e.vao,o),e.vaoEndElement=s.vaoEndElement(e.vao);const a=s.rebuildInstances(o,e.writeableInstances.values(),e.vao);e.updateInstances(),e.holes.clear();const i=e.holes.pushNew();return i.from=a,i.to=e.vaoEndElement,e.updateDrawCommands(this.highlightOrderMap),e}_applyRemoves(e,t){const{_vaoWriter:r}=this;if(0===t.changes.length||null==r)return;let s=1/0,n=-1/0;for(const o of t.changes){const t=o.id,r=e.instances.get(t);if(!r)continue;e.deleteInstance(t),this._useMetalWorkaround&&(s=Math.min(s,r.from),n=Math.max(n,r.to));const a=_.back();if(a){if(a.to===r.from){a.to=r.to;continue}if(a.from===r.to){a.from=r.from;continue}}const i=_.pushNew();i.from=r.from,i.to=r.to}u(_),this._useMetalWorkaround?r.clearHolesMetal(e.instances.values(),s,n,e.vao):r.clearHoles(_,e.vao),e.holes.pushArray(_.data,_.length),_.forAll((e,t)=>_.data[t]=null),_.clear(),e.drawCommandsDirty=!0}_applyAdds(e,t){if(0===t.length||null==this._vaoWriter)return;if(!h(e))return void this._applyAndRebuild(e,t,null);const r=this._vaoWriter,n=e.numElements,o=t.reduce((e,t)=>e+r.elementCount(t),0),a=Math.max(n+o,r.maxElements);if(r.canGrow(e.vao,a))return void this._applyAndRebuild(e,t,null);u(e.holes);const i=new Array;let l=1/0,c=-1/0;for(const s of t){const t=r.elementCount(s),n=y(e.holes,t);i.push(n),this._useMetalWorkaround&&null!=n&&(l=Math.min(n,l),c=Math.max(n+t,c))}const d=this._addInstances(t,e,i);if(this._useMetalWorkaround){for(const e of d);r.writeInstanceRangeMetal(c,l,e.instances.values(),e.vao)}else r.writeRandomInstances(a,d,e.vao);s(t,(e,t)=>null==i[t])}*_addInstances(e,t,r){const s=e.length,n=this._vaoWriter;for(let o=0;o<s;++o){const s=r[o];if(null==s)continue;const a=e[o],i=n.elementCount(a),c=new d(a,s,s+i,this.highlightOrderMap);l(null==t.instances.get(a.id)),t.addInstance(a.id,c),t.drawCommandsDirty=!0,yield c}}static prune(){p.prune()}};e([a({constructOnly:!0})],g.prototype,"dataByOrigin",void 0),e([a({constructOnly:!0})],g.prototype,"material",void 0),e([a()],g.prototype,"highlightOrderMap",void 0),g=e([i("esri.views.3d.webgl-engine.materials.renderers.MergedBuffer")],g);class v{constructor(e){this.origin=e,this.changes=new Array}}function y(e,t){const r=e.find(e=>e.numElements>=t);if(null==r)return null;const s=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),s}const _=new o({allocator:e=>e||new c,deallocator:null});export{g as MergedBuffer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getOrCreateMapValue as t}from"../../../../../core/MapUtils.js";import s from"../../../../../core/PooledArray.js";import{BufferRange as e}from"./BufferRange.js";import{DrawCommand as i}from"./DrawCommand.js";import{defaultHighlightName as n}from"../../../../support/HighlightDefaults.js";class a{constructor(){this._numElements=0,this._instances=new Map,this.holes=new s({allocator:t=>t||new e,deallocator:null}),this.hasHiddenInstances=!1,this.hasOccludees=!1,this.drawCommandsDirty=!0,this.highlightNames=new Set,this.drawCommandsDefault=r(),this.drawCommandsHighlights=new Map,this.drawCommandsOccludees=r(),this.drawCommandsShadowHighlightRest=r()}get numElements(){return this._numElements}get instances(){return this._instances}get hasHighlights(){return this.highlightNames.size>0}resetInstanceSummary(){this.hasHiddenInstances=!1,this.hasOccludees=!1,this.highlightNames.clear()}updateIfDrawCommandsDirty(t
|
|
5
|
+
import{getOrCreateMapValue as t}from"../../../../../core/MapUtils.js";import s from"../../../../../core/PooledArray.js";import{BufferRange as e}from"./BufferRange.js";import{DrawCommand as i}from"./DrawCommand.js";import{defaultHighlightName as n}from"../../../../support/HighlightDefaults.js";class a{constructor(){this.vaoEndElement=0,this._numElements=0,this._instances=new Map,this.holes=new s({allocator:t=>t||new e,deallocator:null}),this.hasHiddenInstances=!1,this.hasOccludees=!1,this.drawCommandsDirty=!0,this.highlightNames=new Set,this.drawCommandsDefault=r(),this.drawCommandsHighlights=new Map,this.drawCommandsOccludees=r(),this.drawCommandsShadowHighlightRest=r()}get numElements(){return this._numElements}get instances(){return this._instances}get writeableInstances(){return this._instances}get hasHighlights(){return this.highlightNames.size>0}resetInstanceSummary(){this.hasHiddenInstances=!1,this.hasOccludees=!1,this.highlightNames.clear()}updateIfDrawCommandsDirty(t){if(this.drawCommandsDirty){this.resetInstanceSummary();for(const t of this.instances.values())this.updateDrawState(t);this.updateDrawCommands(t)}}addInstance(t,s){this.deleteInstance(t),this._instances.set(t,s),this._numElements+=s.numElements}deleteInstance(t){const s=this._instances.get(t);s&&(this._numElements-=s.numElements,this._instances.delete(t))}updateInstances(){let t=0;for(const s of this._instances.values())t+=s.numElements,this.updateDrawState(s);this._numElements=t}updateDrawState(t){if(t.isVisible){const{highlightName:s}=t;s&&this.highlightNames.add(s),t.hasOccludees&&(this.hasOccludees=!0)}else this.hasHiddenInstances=!0}updateDrawCommands(t){if(this.drawCommandsDefault.clear(),this.drawCommandsOccludees.clear(),this.drawCommandsDirty=!1,0===this._instances.size)return;const{sortedInstances:s}=this;if(this._updateHighlightDrawCommands(t,s),!this.needsMultipleCommands){const t=this.drawCommandsDefault.pushNew(),s=this.holes.front();return this.vao&&1===this.holes.length&&s.to===this.vaoEndElement?(t.first=0,void(t.count=s.from)):(t.first=1/0,t.count=0,this._instances.forEach(s=>{t.first=Math.min(t.first,s.from),t.count=Math.max(t.count,s.to)}),void(t.count-=t.first))}for(const e of s)e.isVisible&&m(e.hasOccludees?this.drawCommandsOccludees:this.drawCommandsDefault,e)}get sortedInstances(){return Array.from(this._instances.values()).sort((t,s)=>t.from===s.from?t.to-s.to:t.from-s.from)}updateHighlights(t){this.highlightNames.clear();const s=this.sortedInstances;for(const e of s)e.updateHighlightOptions(t),e.isVisible&&e.highlightName&&this.highlightNames.add(e.highlightName);this._updateHighlightDrawCommands(t)}_updateHighlightDrawCommands(s,e=this.sortedInstances){const{drawCommandsHighlights:i,drawCommandsShadowHighlightRest:a}=this;i.clear(),a.clear();for(const h of e){if(h.updateHighlightOptions(s),!h.isVisible)continue;const{highlightName:e}=h;if(e){this.highlightNames.add(e);m(t(i,e,r),h)}e&&e===n||m(a,h)}}get needsMultipleCommands(){return this.hasOccludees||this.hasHighlights||this.hasHiddenInstances}}class h extends a{}function o(t){return null!=t.vao}function r(){return new s({allocator:t=>t||new i,deallocator:t=>t})}function m(t,s){const e=t.back();if(null==e){const e=t.pushNew();return e.first=s.from,void(e.count=s.numElements)}if(l(e,s)){const t=s.from-e.first+s.numElements;e.count=t}else{const e=t.pushNew();e.first=s.from,e.count=s.numElements}}function l(t,s){return t.first+t.count>=s.from}export{a as PerBufferData,h as PerVaoData,o as hasVao};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{nextHighestPowerOfTwo as t}from"../../../../../core/mathUtils.js";import{copy as e,invert as r,transpose as o}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as i}from"../../../support/buffer/glUtil.js";class a{constructor(t,e){this._bufferWriter=t.createBufferWriter(),this._vaoCache=e.getVaoCache(i(this._bufferWriter.layout))}get maxElements(){return Math.floor(h/this._strideFloats)}get _strideBytes(){return this._bufferWriter.layout.stride}get _strideFloats(){return this._strideBytes/4}vaoEndElement(t){return Math.floor(t.getByteLength("geometry")/this._strideBytes)}evaluateBufferAllocation(t,e,r,o){const s=this._strideFloats,i=e.reduce((t,e)=>t+this.elementCount(e),0),a=r.reduce((t,e)=>t+this.elementCount(e),0),n=Math.min((t+i-a)*s,h),f=o.getByteLength("geometry")/4;return n>l&&n<f/2?0:n>f?1:2}deleteBuffer(t){this._vaoCache.deleteVao(t)}reallocateBuffer(t,e){this.deleteBuffer(t);const r=e*this._strideFloats;return this._vaoCache.newVao(g(r))}elementCount(t){return this._bufferWriter.elementCount(t.geometry.attributes)}canGrow(t,e){const r=4*(e*this._strideFloats);return t.getByteLength("geometry")<g(h-l)&&r>t.getByteLength("geometry")}clearHoles(t,e){const{_strideFloats:r}=this,o=t.reduce((t,e)=>Math.max(t,e.numElements),0)*r,s=b(o);s.fill(0,0,o);const i=e.buffer();for(const a of t)i?.setSubData(s,a.from*r,0,a.numElements*r)}clearHolesMetal(t,e,r,o){const{_bufferWriter:s,_strideFloats:i}=this,a=(r-e)*i,n=b(a),f=s.layout.createView(n.buffer);n.fill(0,0,a);for(const l of t){if(!(l.from>=e&&l.to<=r))continue;const t=l.from-e;this._writeGeometry(l.geometry,f,t)}o.buffer()?.setSubData(n,e*i,0,a)}writeRandomInstances(t,e,r){const{_bufferWriter:o,_strideFloats:s}=this,i=b(t*s),a=o.layout.createView(i.buffer);let n=0,f=0,l=0;const u=r.buffer();for(const m of e){if(!(l===m.from)){const t=l-f;t>0&&u?.setSubData(i,f*s,0,t*s),f=m.from,n=0}this._writeGeometry(m.geometry,a,n),n=m.to,l=m.to}const c=l-f;c>0&&u?.setSubData(i,f*s,0,c*s)}writeInstanceRangeMetal(t,e,r,o){const{_bufferWriter:s,_strideFloats:i}=this,a=t-e,n=a*i,f=b(n),l=s.layout.createView(f.buffer);f.fill(0,0,n);for(const u of r){if(!(u.from>=e&&u.to<=t))continue;const r=u.from-e;this._writeGeometry(u.geometry,l,r)}a>0&&o.buffer()?.setSubData(f,e*i,0,n)}rebuildInstances(t,e,r){const{_bufferWriter:o,_strideFloats:s}=this,i=b(t*s),a=o.layout.createView(i.buffer);let n=0;for(const f of e){this._writeGeometry(f.geometry,a,n);const t=n;n+=this.elementCount(f.geometry),f.from=t,f.to=n}return r.buffer()?.setSubData(i,0,0,n*s),n}updateInstance(t,e){const{_bufferWriter:r,_strideFloats:o}=this,s=b(r.elementCount(t.geometry.geometry.attributes)*o),i=r.layout.createView(s.buffer);this._writeGeometry(t.geometry,i,0),e.buffer()?.setSubData(s,t.from*o,0,t.numElements*o)}_writeGeometry(t,s,i){const{_bufferWriter:a}=this;null!=a&&(e(n,t.transformation),n[12]-=t.localOrigin.vec3[0],n[13]-=t.localOrigin.vec3[1],n[14]-=t.localOrigin.vec3[2],r(f,n),o(f,f),a.write(n,f,t.geometry.attributes,t.geometry.olidColor,s,i))}static prune(){y=new Float32Array(l)}}const n=s(),f=s(),l=65536,u=4*l,c=1024,m=16777216,h=m/4;let y=new Float32Array(l);function b(t){return y.length<t&&(y=new Float32Array(t)),y}function g(e){const r=4*e;return r<=c?c:r<u?t(r):Math.max(Math.min(Math.ceil(1.5*r/u)*u,m),r)}export{a as VaoWriter};
|
package/views/VideoView.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../Color.js";import i from"../Viewpoint.js";import s from"../core/Accessor.js";import{EventedMixin as r}from"../core/Evented.js";import{destroyMaybe as o}from"../core/maybe.js";import{EsriPromiseMixin as a}from"../core/Promise.js";import{watch as n,initial as l,whenOnce as p,syncAndInitial as m}from"../core/reactiveUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as g}from"../core/accessorSupport/ensureType.js";import f from"../geometry/Extent.js";import u from"../geometry/Point.js";import y from"../geometry/SpatialReference.js";import{load as j,execute as w}from"../geometry/operators/projectOperator.js";import b from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as v}from"../layers/support/MediaElementView.js";import M from"../layers/support/TileInfo.js";import _ from"../layers/support/VideoElement.js";import{DOMContainer as S}from"./DOMContainer.js";import{Viewport2DBaseMixin as C}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as V}from"./Viewport2DMixin.js";import x from"./2d/AnimationManager.js";import P from"./2d/MapViewConstraints.js";import"../core/Error.js";import"../core/scheduling.js";import"../core/Logger.js";import"../core/mathUtils.js";import"../config.js";import"../core/floatRGBA.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polygon.js";import"../geometry/Polyline.js";import"../symbols/Font.js";import"../core/ObjectPool.js";import"../geometry/support/spatialReferenceUtils.js";import"../symbols/cim/effects/EffectAddControlPoints.js";import"../symbols/cim/effects/EffectArrow.js";import"../symbols/cim/effects/EffectBuffer.js";import"../symbols/cim/effects/EffectControlMeasureLine.js";import"../symbols/cim/effects/EffectCut.js";import"../symbols/cim/effects/EffectDashes.js";import"../symbols/cim/effects/EffectDonut.js";import"../symbols/cim/effects/EffectEnclosingPolygon.js";import"../symbols/cim/effects/EffectJog.js";import"../symbols/cim/effects/EffectMove.js";import"../symbols/cim/effects/EffectOffset.js";import"../symbols/cim/effects/EffectRadial.js";import"../symbols/cim/effects/EffectReverse.js";import"../symbols/cim/effects/EffectRotate.js";import"../symbols/cim/effects/EffectScale.js";import"../symbols/cim/effects/EffectSuppress.js";import"../symbols/cim/effects/EffectTaperedPolygon.js";import"../symbols/cim/effects/EffectWave.js";import"../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../symbols/cim/placements/PlacementAtExtremities.js";import"../symbols/cim/placements/PlacementAtRatioPositions.js";import"../symbols/cim/placements/PlacementInsidePolygon.js";import"../symbols/cim/placements/PlacementOnLine.js";import"../symbols/cim/placements/PlacementOnVertices.js";import"../symbols/cim/placements/PlacementPolygonCenter.js";import"../symbols/cim/constants.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"../symbols/support/defaults.js";import"../symbols/cim/OverrideHelper.js";import{Container as E}from"./2d/engine/Container.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"./webgl/enums.js";import"./2d/engine/webgl/shaders/BackgroundPrograms.js";import"./webgl/Program.js";import"./webgl/checkWebGLError.js";import"./webgl/VertexAttributeLayouts.js";import"./webgl/BufferObject.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/cpuMapped/MappedMesh.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaders/TileInfoPrograms.js";import"./webgl/Texture.js";import"./2d/engine/webgl/shaders/BitBlitPrograms.js";import"../request.js";import"../core/urlUtils.js";import"../core/pbf.js";import"./2d/engine/webgl/shaders/StencilPrograms.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"./2d/engine/webgl/shaders/HighlightPrograms.js";import"./webgl/FramebufferObject.js";import"./2d/engine/webgl/meshing/SimpleMesh.js";import"./webgl/Renderbuffer.js";import"./2d/engine/webgl/PooledUint32Array.js";import"./2d/engine/webgl/Profiler.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"./2d/engine/webgl/shaderGraph/techniques/animated/attributes.js";import"./2d/engine/webgl/mesh/templates/templateUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../geometry/support/aaBoundingBox.js";import"./2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../core/sql/UnknownTimeZone.js";import"luxon";import"../intl/locale.js";import"../layers/support/fieldUtils.js";import"../time/constants.js";import"./2d/engine/webgl/animations/instructions.js";import"./2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"./webgl/renderState.js";import"./3d/webgl-engine/core/shaderModules/glsl.js";import"./webgl/testSVGPremultipliedAlpha.js";import{ManagedCanvas as G}from"./2d/engine/ManagedCanvas.js";import"./2d/engine/transitions/FadeTransition.js";import"./2d/engine/webgl/meshing/definitions.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import"../chunks/earcut.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtilsCommon.js";import"../geometry/support/Ellipsoid.js";import"../kernel.js";import"./2d/layers/support/util.js";import D from"./2d/navigation/MapViewNavigation.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/unitUtils.js";import"../geometry/ellipsoidUtils.js";import"../chunks/pe.js";import"../geometry/projection/projectors.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import{ViewStateManager as R}from"./2d/ViewStateManager.js";import q from"./2d/engine/webgl/Overlay.js";import z from"./2d/engine/webgl/OverlayContainer.js";import O from"./navigation/Navigation.js";import T from"./ui/DefaultUI.js";import W from"./ui/video/DefaultUIVideo.js";const k=new t("#000");let A;async function U(){const[,{ParentStage:e}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);A=e}const F=.01,H=["feature","geojson","csv","stream","ogc-feature","catalog","wfs","parquet","graphics","group"];let L=class extends(V(C(S(r(a(s)))))){constructor(e){super(e),this._isValid=!1,this._prevZoomEnabled=!1,this._prevRotationEnabled=!1,this.stage=null,this.childStage=null,this._operationalDataView=null,this.operationalDataVisible=!1,this.layer=null,this.map=null,this.navigation=new O,this.ready=!1,this.spatialReference=new y({wkid:0}),this.stateManager=new R({constraints:new P({view:this,minScale:1,maxScale:F})}),this.type="2d",this.ui=new W,this.view2dType="video",this.addHandles([n(()=>this.preconditionsReady,e=>e?this._startup():this._teardown()),n(()=>this.layer,()=>this.addResolvingPromise(p(()=>this.ready)),l),n(()=>this.videoSize,([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}),n(()=>this.size,e=>{this._operationalDataView&&this._operationalDataView.stateManager.resize(e[0],e[1])}),n(()=>[this.layer?.frameEffect,this._effectsContainer],()=>{this._effectsContainer&&(this._effectsContainer.effect=this.layer?.frameEffect??null)},m)])}initialize(){this._prevZoomEnabled="zoom"===this.navigation.actionMap.mouseWheel&&this.ui.components.includes("zoom"),this._prevRotationEnabled="rotate"===this.navigation.actionMap.dragSecondary&&this.ui.components.includes("compass"),this.addHandles([n(()=>[this.operationalDataVisible,this.childStage],()=>{this.childStage&&(this.childStage.videoScreenRenderer.visible=this.operationalDataVisible),this.operationalDataVisible&&(this.scale=1,this.rotation=0),this.navigation&&(this._prevZoomEnabled&&(this.navigation.actionMap.mouseWheel=this.operationalDataVisible?"none":"zoom",this.navigation.actionMap.dragPrimary=this.operationalDataVisible?"none":"pan",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"zoom"!==e):[...new Set([...this.ui.components,"zoom"])])),this._prevRotationEnabled&&(this.navigation.actionMap.dragSecondary=this.operationalDataVisible?"none":"rotate",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"compass"!==e):[...new Set([...this.ui.components,"compass"])])))},m)]),this.addResolvingPromise(U().then(()=>(this._isValid=!0,p(()=>this.ready))))}destroy(){this._teardown(),this.removeAllHandles(),this._set("preconditionsReady",!1),this.frameTask=o(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get preconditionsReady(){return!(!this._isValid||0===this.width||0===this.height||0===this.videoSize[0]||0===this.videoSize[1])}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];const[e,t]=this.size,i=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),s=t*i,r=e/i;return e/t>=1?i>=1?s<=e?[s,t]:[e,r]:r<=t?[e,r]:[s,t]:i>=1?r<=t?[e,r]:[s,t]:s<=e?[s,t]:[e,r]}async hitTest(e,t){return this._operationalDataView&&this._operationalDataView.ready?this._operationalDataView.hitTest(e,t):{screenPoint:e,results:[]}}_startup(){if(!this.layer)return;const e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference);const t={renderingOptions:this.renderingOptions,backgroundColor:k,groundControlPoints:()=>this.layer?.groundControlPoints,getSize:()=>this.videoSize},i=new A(this.surface,t,new G(this.surface));this.stage=i,this._prepareStage(this.stage),this.childStage=i.childStage,this._prepareChildStage(this.childStage);const s=new x({view:this});this._set("animationManager",s);const r=new D({view:this,animationManager:s});this._set("mapViewNavigation",r),this._updateConstraints(),this.frameTask.start(),this._set("ready",!0)}_teardown(){this.stage.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer.removeAllChildren(),this._overlayContainer=null,this.removeHandles("video-view"),this._set("ready",!1),this.stateManager.teardown(),this.frameTask.stop(),this.stationaryManager.clear()}_getViewpoint(){return new i({targetGeometry:new u({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([n(()=>this.stationary,t=>e.stationary=t,m),n(()=>this.state.id,()=>e.state=this.state,m),n(()=>this.renderingOptions,t=>e.renderingOptions=t,m)],"video-view"),this._extent=new f({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new v({element:new _({video:this.layer?.videoElement,georeference:new b({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});const t=new q(this._videoElementView);this._overlayContainer=new z,this._overlayContainer.addChild(t),this._effectsContainer=new E,this._effectsContainer.addChild(this._overlayContainer),this.stage.addChild(this._effectsContainer);const i=document.createElement("div");i.classList.add("esri-video-poster"),this.container?.classList.add("esri-video-view"),this.container?.appendChild(i)}_prepareChildStage(e){this.addHandles([n(()=>this.map,async t=>{if(!t)return;const{default:i}=await import("./video/VideoOperationalDataView.js");this._operationalDataView=new i({stage:e,layerViewFilter:e=>new Set(H).has(e.type),width:this.size[0],height:this.size[1],map:t}),p(()=>this._operationalDataView?.ready).then(()=>{e.videoScreenRenderer.visible=this.operationalDataVisible})},m),n(()=>this.layer?.groundControlPoints,async()=>{if(!this.layer?.groundControlPoints||!e.state)return;const t=this.layer.groundControlPoints,i=t?.length;if(!i)return;await j();const s=new Array(i),r=e.state.spatialReference;for(let e=0;e<i;e++){const{lat:i,lon:o}=t[e];s[e]=w(new u(o,i),r)}let o=1/0,a=1/0,n=-1/0,l=-1/0;for(const e of s)o=Math.min(o,e.x),a=Math.min(a,e.y),n=Math.max(n,e.x),l=Math.max(l,e.y);const p=f.fromJSON({xmin:o,ymin:a,xmax:n,ymax:l,spatialReference:r});await(this._operationalDataView?.goTo(p,{animate:!1}).catch(()=>{}))},m)])}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){const e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),i=[];for(let r=t;r>F;r/=2)i.push(r);i.push(F);const{lods:s}=M.create({scales:i});this.constraints.set({lods:s,minScale:t})}_updatePanConstraints(){const e=e=>{if(!e.targetGeometry)return e;const[t,i]=this.videoSize,s=t*e.scale/2,r=i*e.scale/2,o=e.targetGeometry.clone();return o.x=Math.max(s,Math.min(t-s,o.x)),o.y=Math.max(r,Math.min(i-r,o.y)),e.targetGeometry=o,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}};e([h()],L.prototype,"_overlayContainer",void 0),e([h()],L.prototype,"_isValid",void 0),e([h()],L.prototype,"_effectsContainer",void 0),e([h()],L.prototype,"constraintsInfo",null),e([h()],L.prototype,"operationalDataVisible",void 0),e([h()],L.prototype,"layer",void 0),e([h()],L.prototype,"map",void 0),e([h({type:O,nonNullable:!0})],L.prototype,"navigation",void 0),e([h({readOnly:!0})],L.prototype,"preconditionsReady",null),e([h({readOnly:!0})],L.prototype,"ready",void 0),e([h({readOnly:!0})],L.prototype,"rendering",null),e([h()],L.prototype,"scale",null),e([h()],L.prototype,"spatialReference",void 0),e([h()],L.prototype,"stateManager",void 0),e([h()],L.prototype,"type",void 0),e([h(),d(e=>e instanceof T?e:g(W,e))],L.prototype,"ui",void 0),e([h({readOnly:!0})],L.prototype,"videoSize",null),e([h({readOnly:!0})],L.prototype,"view2dType",void 0),L=e([c("esri.views.VideoView")],L);const B=L;export{B as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../Color.js";import i from"../Viewpoint.js";import s from"../core/Accessor.js";import{EventedMixin as r}from"../core/Evented.js";import{destroyMaybe as o}from"../core/maybe.js";import{EsriPromiseMixin as a}from"../core/Promise.js";import{watch as n,initial as l,whenOnce as p,syncAndInitial as m}from"../core/reactiveUtils.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as g}from"../core/accessorSupport/ensureType.js";import f from"../geometry/Extent.js";import u from"../geometry/Point.js";import y from"../geometry/SpatialReference.js";import{load as j,execute as w}from"../geometry/operators/projectOperator.js";import b from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as v}from"../layers/support/MediaElementView.js";import M from"../layers/support/TileInfo.js";import S from"../layers/support/VideoElement.js";import{DOMContainer as _}from"./DOMContainer.js";import{Viewport2DBaseMixin as C}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as V}from"./Viewport2DMixin.js";import x from"./2d/AnimationManager.js";import P from"./2d/MapViewConstraints.js";import"../core/Error.js";import"../core/scheduling.js";import"../core/Logger.js";import"../core/mathUtils.js";import"../config.js";import"../core/floatRGBA.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polygon.js";import"../geometry/Polyline.js";import"../symbols/Font.js";import"../core/ObjectPool.js";import"../geometry/support/spatialReferenceUtils.js";import"../symbols/cim/effects/EffectAddControlPoints.js";import"../symbols/cim/effects/EffectArrow.js";import"../symbols/cim/effects/EffectBuffer.js";import"../symbols/cim/effects/EffectControlMeasureLine.js";import"../symbols/cim/effects/EffectCut.js";import"../symbols/cim/effects/EffectDashes.js";import"../symbols/cim/effects/EffectDonut.js";import"../symbols/cim/effects/EffectEnclosingPolygon.js";import"../symbols/cim/effects/EffectJog.js";import"../symbols/cim/effects/EffectMove.js";import"../symbols/cim/effects/EffectOffset.js";import"../symbols/cim/effects/EffectRadial.js";import"../symbols/cim/effects/EffectReverse.js";import"../symbols/cim/effects/EffectRotate.js";import"../symbols/cim/effects/EffectScale.js";import"../symbols/cim/effects/EffectSuppress.js";import"../symbols/cim/effects/EffectTaperedPolygon.js";import"../symbols/cim/effects/EffectWave.js";import"../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../symbols/cim/placements/PlacementAtExtremities.js";import"../symbols/cim/placements/PlacementAtRatioPositions.js";import"../symbols/cim/placements/PlacementInsidePolygon.js";import"../symbols/cim/placements/PlacementOnLine.js";import"../symbols/cim/placements/PlacementOnVertices.js";import"../symbols/cim/placements/PlacementPolygonCenter.js";import"../symbols/cim/constants.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"../symbols/support/defaults.js";import"../symbols/cim/OverrideHelper.js";import{Container as G}from"./2d/engine/Container.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"./webgl/enums.js";import"./2d/engine/webgl/shaders/BackgroundPrograms.js";import"./webgl/Program.js";import"./webgl/checkWebGLError.js";import"./webgl/VertexAttributeLayouts.js";import"./webgl/BufferObject.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/cpuMapped/MappedMesh.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaders/TileInfoPrograms.js";import"./webgl/Texture.js";import"./2d/engine/webgl/shaders/BitBlitPrograms.js";import"../request.js";import"../core/urlUtils.js";import"../core/pbf.js";import"./2d/engine/webgl/shaders/StencilPrograms.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"./2d/engine/webgl/shaders/HighlightPrograms.js";import"./webgl/FramebufferObject.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlitShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BloomShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlurShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/ColorizeShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js";import"./2d/engine/webgl/meshing/SimpleMesh.js";import"./webgl/Renderbuffer.js";import"./2d/engine/webgl/PooledUint32Array.js";import"./2d/engine/webgl/Profiler.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"./2d/engine/webgl/shaderGraph/techniques/animated/attributes.js";import"./2d/engine/webgl/mesh/templates/templateUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../geometry/support/aaBoundingBox.js";import"./2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../core/sql/UnknownTimeZone.js";import"luxon";import"../intl/locale.js";import"../layers/support/fieldUtils.js";import"../time/constants.js";import"./2d/engine/webgl/animations/instructions.js";import"./2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"./webgl/renderState.js";import"./3d/webgl-engine/core/shaderModules/glsl.js";import"./webgl/testSVGPremultipliedAlpha.js";import{ManagedCanvas as E}from"./2d/engine/ManagedCanvas.js";import"./2d/engine/transitions/FadeTransition.js";import"./2d/engine/webgl/meshing/definitions.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import"../chunks/earcut.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtilsCommon.js";import"../geometry/support/Ellipsoid.js";import"../kernel.js";import"./2d/layers/support/util.js";import D from"./2d/navigation/MapViewNavigation.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/unitUtils.js";import"../geometry/ellipsoidUtils.js";import"../chunks/pe.js";import"../geometry/projection/projectors.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import{ViewStateManager as R}from"./2d/ViewStateManager.js";import q from"./2d/engine/webgl/Overlay.js";import z from"./2d/engine/webgl/OverlayContainer.js";import O from"./navigation/Navigation.js";import T from"./ui/DefaultUI.js";import W from"./ui/video/DefaultUIVideo.js";const k=new t("#000");let A;async function U(){const[,{ParentStage:e}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);A=e}const B=.01,F=["feature","geojson","csv","stream","ogc-feature","catalog","wfs","parquet","graphics","group"];let H=class extends(V(C(_(r(a(s)))))){constructor(e){super(e),this._isValid=!1,this._prevZoomEnabled=!1,this._prevRotationEnabled=!1,this.stage=null,this.childStage=null,this._operationalDataView=null,this.operationalDataVisible=!1,this.layer=null,this.map=null,this.navigation=new O,this.ready=!1,this.spatialReference=new y({wkid:0}),this.stateManager=new R({constraints:new P({view:this,minScale:1,maxScale:B})}),this.type="2d",this.ui=new W,this.view2dType="video",this.addHandles([n(()=>this.preconditionsReady,e=>e?this._startup():this._teardown()),n(()=>this.layer,()=>this.addResolvingPromise(p(()=>this.ready)),l),n(()=>this.videoSize,([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}),n(()=>this.size,e=>{this._operationalDataView&&this._operationalDataView.stateManager.resize(e[0],e[1])}),n(()=>[this.layer?.frameEffect,this._effectsContainer],()=>{this._effectsContainer&&(this._effectsContainer.effect=this.layer?.frameEffect??null)},m)])}initialize(){this._prevZoomEnabled="zoom"===this.navigation.actionMap.mouseWheel&&this.ui.components.includes("zoom"),this._prevRotationEnabled="rotate"===this.navigation.actionMap.dragSecondary&&this.ui.components.includes("compass"),this.addHandles([n(()=>[this.operationalDataVisible,this.childStage],()=>{this.childStage&&(this.childStage.videoScreenRenderer.visible=this.operationalDataVisible),this.operationalDataVisible&&(this.scale=1,this.rotation=0),this.navigation&&(this._prevZoomEnabled&&(this.navigation.actionMap.mouseWheel=this.operationalDataVisible?"none":"zoom",this.navigation.actionMap.dragPrimary=this.operationalDataVisible?"none":"pan",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"zoom"!==e):[...new Set([...this.ui.components,"zoom"])])),this._prevRotationEnabled&&(this.navigation.actionMap.dragSecondary=this.operationalDataVisible?"none":"rotate",this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>"compass"!==e):[...new Set([...this.ui.components,"compass"])])))},m)]),this.addResolvingPromise(U().then(()=>(this._isValid=!0,p(()=>this.ready))))}destroy(){this._teardown(),this.removeAllHandles(),this._set("preconditionsReady",!1),this.frameTask=o(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get preconditionsReady(){return!(!this._isValid||0===this.width||0===this.height||0===this.videoSize[0]||0===this.videoSize[1])}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];const[e,t]=this.size,i=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),s=t*i,r=e/i;return e/t>=1?i>=1?s<=e?[s,t]:[e,r]:r<=t?[e,r]:[s,t]:i>=1?r<=t?[e,r]:[s,t]:s<=e?[s,t]:[e,r]}async hitTest(e,t){return this._operationalDataView&&this._operationalDataView.ready?this._operationalDataView.hitTest(e,t):{screenPoint:e,results:[]}}_startup(){if(!this.layer)return;const e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference);const t={renderingOptions:this.renderingOptions,backgroundColor:k,groundControlPoints:()=>this.layer?.groundControlPoints,getSize:()=>this.videoSize},i=new A(this.surface,t,new E(this.surface));this.stage=i,this._prepareStage(this.stage),this.childStage=i.childStage,this._prepareChildStage(this.childStage);const s=new x({view:this});this._set("animationManager",s);const r=new D({view:this,animationManager:s});this._set("mapViewNavigation",r),this._updateConstraints(),this.frameTask.start(),this._set("ready",!0)}_teardown(){this.stage.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer.removeAllChildren(),this._overlayContainer=null,this.removeHandles("video-view"),this._set("ready",!1),this.stateManager.teardown(),this.frameTask.stop(),this.stationaryManager.clear()}_getViewpoint(){return new i({targetGeometry:new u({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([n(()=>this.stationary,t=>e.stationary=t,m),n(()=>this.state.id,()=>e.state=this.state,m),n(()=>this.renderingOptions,t=>e.renderingOptions=t,m)],"video-view"),this._extent=new f({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new v({element:new S({video:this.layer?.videoElement,georeference:new b({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});const t=new q(this._videoElementView);this._overlayContainer=new z,this._overlayContainer.addChild(t),this._effectsContainer=new G,this._effectsContainer.addChild(this._overlayContainer),this.stage.addChild(this._effectsContainer);const i=document.createElement("div");i.classList.add("esri-video-poster"),this.container?.classList.add("esri-video-view"),this.container?.appendChild(i)}_prepareChildStage(e){this.addHandles([n(()=>this.map,async t=>{if(!t)return;const{default:i}=await import("./video/VideoOperationalDataView.js");this._operationalDataView=new i({stage:e,layerViewFilter:e=>new Set(F).has(e.type),width:this.size[0],height:this.size[1],map:t}),p(()=>this._operationalDataView?.ready).then(()=>{e.videoScreenRenderer.visible=this.operationalDataVisible})},m),n(()=>this.layer?.groundControlPoints,async()=>{if(!this.layer?.groundControlPoints||!e.state)return;const t=this.layer.groundControlPoints,i=t?.length;if(!i)return;await j();const s=new Array(i),r=e.state.spatialReference;for(let e=0;e<i;e++){const{lat:i,lon:o}=t[e];s[e]=w(new u(o,i),r)}let o=1/0,a=1/0,n=-1/0,l=-1/0;for(const e of s)o=Math.min(o,e.x),a=Math.min(a,e.y),n=Math.max(n,e.x),l=Math.max(l,e.y);const p=f.fromJSON({xmin:o,ymin:a,xmax:n,ymax:l,spatialReference:r});await(this._operationalDataView?.goTo(p,{animate:!1}).catch(()=>{}))},m)])}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){const e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),i=[];for(let r=t;r>B;r/=2)i.push(r);i.push(B);const{lods:s}=M.create({scales:i});this.constraints.set({lods:s,minScale:t})}_updatePanConstraints(){const e=e=>{if(!e.targetGeometry)return e;const[t,i]=this.videoSize,s=t*e.scale/2,r=i*e.scale/2,o=e.targetGeometry.clone();return o.x=Math.max(s,Math.min(t-s,o.x)),o.y=Math.max(r,Math.min(i-r,o.y)),e.targetGeometry=o,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}};e([h()],H.prototype,"_overlayContainer",void 0),e([h()],H.prototype,"_isValid",void 0),e([h()],H.prototype,"_effectsContainer",void 0),e([h()],H.prototype,"constraintsInfo",null),e([h()],H.prototype,"operationalDataVisible",void 0),e([h()],H.prototype,"layer",void 0),e([h()],H.prototype,"map",void 0),e([h({type:O,nonNullable:!0})],H.prototype,"navigation",void 0),e([h({readOnly:!0})],H.prototype,"preconditionsReady",null),e([h({readOnly:!0})],H.prototype,"ready",void 0),e([h({readOnly:!0})],H.prototype,"rendering",null),e([h()],H.prototype,"scale",null),e([h()],H.prototype,"spatialReference",void 0),e([h()],H.prototype,"stateManager",void 0),e([h()],H.prototype,"type",void 0),e([h(),d(e=>e instanceof T?e:g(W,e))],H.prototype,"ui",void 0),e([h({readOnly:!0})],H.prototype,"videoSize",null),e([h({readOnly:!0})],H.prototype,"view2dType",void 0),H=e([c("esri.views.VideoView")],H);const L=H;export{L as default};
|