@arcgis/core 4.33.0-next.20250311 → 4.33.0-next.20250313
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/Basemap.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/025f8b72d7d8b5cccb0f.js +1 -0
- package/assets/esri/core/workers/chunks/{5b1b93665c93955491c4.js → 08bfceab05b5ea02bb4e.js} +106 -107
- package/assets/esri/core/workers/chunks/{bc988b9d3990380be907.js → 0a98dc3ea67ce97a6e7b.js} +1 -1
- package/assets/esri/core/workers/chunks/0e5c77d043ed4641556f.js +1 -0
- package/assets/esri/core/workers/chunks/10fc47b441ae49ef4db8.js +1 -0
- package/assets/esri/core/workers/chunks/{eacab4bd6eb58e545f73.js → 11f9d7cd95891596b716.js} +1 -1
- package/assets/esri/core/workers/chunks/{4263eee3247aaf4e64bf.js → 147e412de9972da16a1d.js} +1 -1
- package/assets/esri/core/workers/chunks/4908b36ef448bfe1f448.js +1 -0
- package/assets/esri/core/workers/chunks/4d95cc85f4b73e857b1f.js +1 -0
- package/assets/esri/core/workers/chunks/54ace3e4802934f3f9f2.js +1 -0
- package/assets/esri/core/workers/chunks/5820808c7659460969d4.js +1 -0
- package/assets/esri/core/workers/chunks/6388fdacb434a266b039.js +314 -0
- package/assets/esri/core/workers/chunks/add0770399a63b7635b5.js +1 -0
- package/assets/esri/core/workers/chunks/b2f8702a9f54fff23ad9.js +1 -0
- package/assets/esri/core/workers/chunks/b8b8425e8b1246cdc86d.js +1 -0
- package/assets/esri/core/workers/chunks/d0fbd4c6bffe0cb98d14.js +1 -0
- package/assets/esri/core/workers/chunks/{2c227d97d00b3849f441.js → d459c790a3b89ac53d2d.js} +1 -1
- package/assets/esri/core/workers/chunks/dd6f18bbab50be139d20.js +1 -0
- package/assets/esri/core/workers/chunks/de6864e120243cf0bee8.js +1 -0
- package/assets/esri/core/workers/chunks/fc7ce48c7b31a4665a9b.js +1 -0
- package/assets/esri/core/workers/chunks/fe6e7ac83cd2293d576e.js +1 -0
- package/chunks/ComponentShader.glsl.js +7 -8
- package/chunks/DefaultMaterial.glsl.js +21 -21
- package/chunks/HighlightApply.glsl.js +27 -132
- package/chunks/{SingleHighlightBlur.glsl.js → HighlightBlur.glsl.js} +4 -4
- package/chunks/HighlightDownsample.glsl.js +8 -8
- package/chunks/HighlightToSingle.glsl.js +2 -2
- package/chunks/Pattern.glsl.js +23 -25
- package/chunks/RealisticTree.glsl.js +12 -12
- package/chunks/ShadowHighlight.glsl.js +5 -6
- package/chunks/Terrain.glsl.js +30 -31
- package/core/LRUCache.js +1 -1
- package/core/MemCache.js +1 -1
- package/core/has.js +1 -1
- package/geometry/support/ShortArray.js +5 -0
- package/interfaces.d.ts +18 -4
- package/layers/support/layerUtils.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/webgl/Painter.js +1 -1
- package/views/2d/engine/webgl/WorldExtentClipRenderer.js +1 -1
- package/views/2d/engine/webgl/effects/FeatureEffect.js +1 -1
- package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
- package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedComputedData.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/CloudsRenderer.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/LabelInfo.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/graphics/pipeline/featureData/processingUtils.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/LodRenderer.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
- package/views/3d/layers/graphics/pipeline/utils.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/support/flowUtils.js +5 -0
- package/views/3d/terrain/OverlayRenderTargets.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl/ManagedFBO.js +1 -1
- package/views/3d/webgl/formats.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/HighlightCellGridScreenSpacePass.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/HighlightReadBitmap.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +63 -77
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +7 -8
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +18 -18
- package/views/3d/webgl-engine/core/shaderModules/UintTexture2DBindUniform.js +5 -0
- package/views/3d/webgl-engine/core/shaderModules/UintTexture2DDrawUniform.js +5 -0
- package/views/3d/webgl-engine/core/shaderModules/UintTexture2DPassUniform.js +5 -0
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/HighlightBlurTechnique.js +5 -0
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/OITBlendTechnique.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Normals.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
- package/views/3d/webgl-engine/lib/Program.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/parts/Model.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/{SingleHighlightBlur.glsl.js → HighlightBlur.glsl.js} +1 -1
- package/views/3d/webgl-engine/shaders/HighlightDownsample.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightToSingle.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
- package/views/FocusAreas.js +1 -1
- package/views/animation/easing.js +1 -1
- package/views/support/imageReprojection.js +1 -1
- package/views/support/projectionUtils.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/ShaderBuilder.js +1 -1
- package/views/webgl/ShaderTranspiler.js +1 -1
- package/views/webgl/ValidatedTextureDescriptor.js +1 -1
- package/views/webgl/enums.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/support/GoTo.js +1 -1
- package/widgets/support/goToUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0137c17f15d79134b4ca.js +0 -314
- package/assets/esri/core/workers/chunks/15fe629cd4da1bb2169f.js +0 -1
- package/assets/esri/core/workers/chunks/3bbf7f89bc37c01b453b.js +0 -1
- package/assets/esri/core/workers/chunks/40f2c8022fd583c43f42.js +0 -1
- package/assets/esri/core/workers/chunks/4f2bb248dd258b493663.js +0 -1
- package/assets/esri/core/workers/chunks/5295e685ae839087c568.js +0 -1
- package/assets/esri/core/workers/chunks/54b115ecf446b4095d3e.js +0 -1
- package/assets/esri/core/workers/chunks/5a536de1ecae424bad05.js +0 -1
- package/assets/esri/core/workers/chunks/7ca9230681d05ef89059.js +0 -1
- package/assets/esri/core/workers/chunks/8196ff250c0de00104f7.js +0 -1
- package/assets/esri/core/workers/chunks/840c02610d845114ace7.js +0 -1
- package/assets/esri/core/workers/chunks/a4228101f709f0bb9a3d.js +0 -1
- package/assets/esri/core/workers/chunks/be883ebdbaf11647b718.js +0 -1
- package/assets/esri/core/workers/chunks/d374d2a1487faee3672d.js +0 -1
- package/assets/esri/core/workers/chunks/dbdca19978fbee8dc106.js +0 -1
- package/assets/esri/core/workers/chunks/ffd28a9b1d8db3a731f4.js +0 -1
- package/chunks/SingleHighlightApply.glsl.js +0 -32
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/PositionAttribute.glsl.js +0 -5
- package/views/3d/webgl-engine/effects/highlight/SingleHighlightApplyTechnique.js +0 -5
- package/views/3d/webgl-engine/effects/highlight/SingleHighlightBlurTechnique.js +0 -5
- package/views/3d/webgl-engine/shaders/SingleHighlightApply.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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";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 u,watch as l}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{create as _,equals as m,clone as g,expand as F,toExtent as y}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as T,hasVertices as x}from"../../../../layers/graphics/dehydratedFeatures.js";import R from"../../../../rest/support/QuantizationParameters.js";import v from"../../../../rest/support/Query.js";import{ViewingMode as b}from"../../../ViewingMode.js";import{MultiFeatureReference as C,SingleFeatureReference as E}from"./featureReference.js";import{failedFeatureCount as M,FeatureTile as D,ReduceMode as w}from"./FeatureTile.js";import{tilesAreRelated as U}from"../../terrain/tileUtils.js";import{TaskPriority as j,ImmediateTask as O}from"../../../support/Scheduler.js";let A=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 running(){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 hasAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(const e of this._featureTiles.values())if(!this.hasFullGeometries&&0!==e.emptyFeatureRatio||!e.hasAllFeatures)return!1;return!0}get hasFullGeometries(){if(!this._supportsResolution)return!0;return this.tileDescriptors.some(P)||!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(this.context.viewingMode===b.Global){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(j.FEATURE_TILE_FETCHER,this)??O,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?C:E,this._objectIdField=t.objectIdField}initialize(){this.addHandles([u((()=>this.tileDescriptors),"change",(()=>this._setDirty())),l((()=>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()}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(T(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?T(i,t):null}async _applyEditsAddUpdateFeatures(e,t,s){const{objectIdField:r,globalIdField:a}=this.context,n=a&&this.availableFields.has(a),o=new Set,u=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),u.add(e))}if(0===o.size)return;const l=[];this._featureTiles.forEach((e=>{const t=this._applyEditsAddUpdateTile(e,o,u,s);t&&l.push(t)})),this._updated(),await Promise.allSettled(l)}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(T(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,Q(e.availableFields,a.fields),N(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:H})}_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._getListOfTiles();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=M)),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.featuresMissing=!0,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,L),i.intersectionIncludingBorrowed(e,k),m(L,k)||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=T(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,u=0;t?(u=t,o=Math.min(r*t/i,t)):(u=s,o=r),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set("updatingTotal",u),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=I(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 D(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&&U(e.descriptor.lij,s.descriptor.lij)){null==e.displayingFeatures&&(e.displayingFeatures=[]),e.descriptor.extent&&s.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=g(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(T(i,this._objectIdField));s.ref(s.feature,t),this._numDisplayingFeatureReferences++}}})),e.featureLimit=null!=e.displayingFeatures?e.displayingFeatures.length:0}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(!1):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._getListOfTiles())}async _fetchTile(e,t){e.fetchFailed=!1;const s=this._maximumFeaturesForTile(e);if(s<=0)return e.hasPreciseFeatureCount&&0===e.numFeatures||(e.fetchFailed=!0),z(e),!1;const i=this._getMaxRecordCount(e),r=Math.ceil(s/i);if(e.fetchingResolution=e.descriptor.resolution,P(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=s&&r>v.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)}const{features:o,exceededTransferLimit:u,fields:l,missingAttributes:h}=await this._queryFeatures(a,t),d=!u||a.maxRecordCountFactor>=v.MAX_MAX_RECORD_COUNT_FACTOR;return await this._frameTask.schedule((()=>{e.featuresMissing=e.hasPreciseFeatureCount&&o.length<e.numFeatures||!!u;const t=this._removeEmptyFeatures(o);e.setFeatures(o,t,q(l),N(void 0,h)),this._updateTileZQuantization(e)}),t),n(t),this._invalidateCounts(),d}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 u=this._getMaxRecordCount(e);let l,h=null;for(;;){const d=this._createQuery(e),c=this._setPagingParameters(d,i,o,u),{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),e.featuresMissing=c&&e.hasPreciseFeatureCount&&i<e.numFeatures||!!f,s=s?.concat(p)??p,h=Q(h,_),l=N(l,m),e.setFeatures(s,r,h,l),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()}),t),n(t),o=this._maximumFeaturesForTile(e)-a,!c||!f||o<=0)return!f}}_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();t.resultType=this._resultType(e);const s=P(e);return s||(t.geometry=y(e.descriptor.extent,this.context.tilingScheme.spatialReference)),this._setResolutionParams(t,e),"tile"!==t.resultType&&this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),!s&&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(P(e)||!this._supportsResolution)return null;const t=this.context.viewingMode===b.Global?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 R({mode:"view",originPosition:"upper-left",tolerance:s,extent:this.context.fullExtent}):"polyline"===this.context.geometryType&&(e.maxAllowableOffset=s))}_removeEmptyFeatures(e){const t=e.length;return s(e,(({geometry:e})=>x(e))),t-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!P(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||S}_resultType(e){if(this.context.capabilities.supportsResultType)return P(e)?"standard":"tile"}get _reduceMode(){const e=this.context.geometryType;return"polygon"===e||"polyline"===e?w.SIZE:w.RANDOM}_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(!1)),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{features:t}=e;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);e.featureLimit=a;for(let n=0;n<a;++n){const e=t[n],a=T(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=T(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+Z,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")}_getListOfTiles(){return Array.from(this._featureTiles.values())}get storedFeatures(){return this._getListOfTiles().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)}_maximumFeaturesForTile(e){const t=e.hasPreciseFeatureCount?e.numFeatures:1/0,s=e.hasPreciseFeatureCount?t:this.maximumNumberOfFeatures,i=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(s*i/(1-e.emptyFeatureRatio)),t)}get test(){}};function P(e){return"dummy-tile-full-extent"===e.id}function I(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 z(e){e.setFeatures([],0,null,void 0),e.featuresMissing=!1}function q(e){return null==e?new Set:new Set(e.map((e=>e.name)))}function Q(e,t){if(null==e||null==t)return q(t);const s=new Set;for(const{name:i}of t)e.has(i)&&s.add(i);return s}function N(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})],A.prototype,"features",void 0),e([p()],A.prototype,"tileDescriptors",void 0),e([p({value:1/0})],A.prototype,"maximumNumberOfFeatures",null),e([p({value:1})],A.prototype,"memoryFactor",null),e([p({value:1})],A.prototype,"lodFactor",null),e([p()],A.prototype,"useTileCount",null),e([p({readOnly:!0})],A.prototype,"updating",null),e([p({readOnly:!0})],A.prototype,"dataUpdating",void 0),e([p({readOnly:!0})],A.prototype,"updatingTotal",void 0),e([p({readOnly:!0})],A.prototype,"updatingRemaining",void 0),e([p({readOnly:!0})],A.prototype,"expectedFeatureDiff",void 0),e([p({readOnly:!0})],A.prototype,"memoryForUnusedFeatures",null),e([p({readOnly:!0})],A.prototype,"maximumNumberOfFeaturesExceeded",void 0),e([p({readOnly:!0})],A.prototype,"totalVertices",null),e([p({readOnly:!0})],A.prototype,"totalFeatures",null),e([p({readOnly:!0})],A.prototype,"hasAllFeatures",null),e([p({readOnly:!0})],A.prototype,"hasFullGeometries",null),e([p()],A.prototype,"filterExtent",null),e([p({constructOnly:!0})],A.prototype,"context",void 0),e([p()],A.prototype,"_dirty",void 0),e([p()],A.prototype,"_suspended",void 0),e([p()],A.prototype,"_pendingEdits",void 0),e([p()],A.prototype,"_applyEditsTilesUpdated",void 0),e([p()],A.prototype,"_paused",null),e([p()],A.prototype,"_isFetching",void 0),A=e([f("esri.views.3d.layers.support.FeatureTileFetcher3D")],A);const S=2e3,L=_(),k=_(),H=6e5,Z=200;export{A as FeatureTileFetcher3D};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";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 u,watch as l}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 R}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as v,hasVertices as b,computeAABR as C}from"../../../../layers/graphics/dehydratedFeatures.js";import E from"../../../../rest/support/QuantizationParameters.js";import M from"../../../../rest/support/Query.js";import{ViewingMode as D}from"../../../ViewingMode.js";import{MultiFeatureReference as w,SingleFeatureReference as U}from"./featureReference.js";import{failedFeatureCount as j,FeatureTile as O,ReduceMode as A}from"./FeatureTile.js";import{tilesAreRelated as P}from"../../terrain/tileUtils.js";import{TaskPriority as I,ImmediateTask 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 running(){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 hasAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(const e of this._featureTiles.values())if(!this.hasFullGeometries&&0!==e.emptyFeatureRatio||!e.hasAllFeatures)return!1;return!0}get hasFullGeometries(){if(!this._supportsResolution)return!0;return this.tileDescriptors.some(Q)||!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(this.context.viewingMode===D.Global){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(I.FEATURE_TILE_FETCHER,this)??z,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?w:U,this._objectIdField=t.objectIdField}initialize(){this.addHandles([u((()=>this.tileDescriptors),"change",(()=>this._setDirty())),l((()=>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()}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(v(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?v(i,t):null}async _applyEditsAddUpdateFeatures(e,t,s){const{objectIdField:r,globalIdField:a}=this.context,n=a&&this.availableFields.has(a),o=new Set,u=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),u.add(e))}if(0===o.size)return;const l=[];this._featureTiles.forEach((e=>{const t=this._applyEditsAddUpdateTile(e,o,u,s);t&&l.push(t)})),this._updated(),await Promise.allSettled(l)}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(v(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,k(e.availableFields,a.fields),H(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:X})}_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._getListOfTiles();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=j)),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.featuresMissing=!0,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,V),i.intersectionIncludingBorrowed(e,G),g(V,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=v(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,u=0;t?(u=t,o=Math.min(r*t/i,t)):(u=s,o=r),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set("updatingTotal",u),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=N(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 O(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&&P(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(v(i,this._objectIdField));s.ref(s.feature,t),this._numDisplayingFeatureReferences++}}})),e.featureLimit=null!=e.displayingFeatures?e.displayingFeatures.length:0}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(!1):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._getListOfTiles())}async _fetchTile(e,t){e.fetchFailed=!1;const s=this._maximumFeaturesForTile(e);if(s<=0)return e.hasPreciseFeatureCount&&0===e.numFeatures||(e.fetchFailed=!0),S(e),!1;const i=this._getMaxRecordCount(e),r=Math.ceil(s/i);if(e.fetchingResolution=e.descriptor.resolution,Q(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=s&&r>M.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)}const{features:o,exceededTransferLimit:u,fields:l,missingAttributes:h}=await this._queryFeatures(a,t),d=!u||a.maxRecordCountFactor>=M.MAX_MAX_RECORD_COUNT_FACTOR;return await this._frameTask.schedule((()=>{e.featuresMissing=e.hasPreciseFeatureCount&&o.length<e.numFeatures||!!u;const t=this._removeEmptyFeatures(o,this._getEffectiveTileResolution(e));e.setFeatures(o,t,L(l),H(void 0,h)),this._updateTileZQuantization(e)}),t),n(t),this._invalidateCounts(),d}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 u=this._getMaxRecordCount(e);let l,h=null;for(;;){const d=this._createQuery(e),c=this._setPagingParameters(d,i,o,u),{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.featuresMissing=c&&e.hasPreciseFeatureCount&&i<e.numFeatures||!!f,s=s?.concat(p)??p,h=k(h,_),l=H(l,m),e.setFeatures(s,r,h,l),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()}),t),n(t),o=this._maximumFeaturesForTile(e)-a,!c||!f||o<=0)return!f}}_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();t.resultType=this._resultType(e);const s=Q(e);return s||(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&&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(Q(e)||!this._supportsResolution)return null;const t=this.context.viewingMode===D.Global?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 E({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))&&(C(e,B),x(B)>i||R(B)>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||Z}_resultType(e){if(this.context.capabilities.supportsResultType)return Q(e)?"standard":"tile"}get _reduceMode(){const e=this.context.geometryType;return"polygon"===e||"polyline"===e?A.SIZE:A.RANDOM}_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(!1)),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{features:t}=e;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);e.featureLimit=a;for(let n=0;n<a;++n){const e=t[n],a=v(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=v(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+$,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")}_getListOfTiles(){return Array.from(this._featureTiles.values())}get storedFeatures(){return this._getListOfTiles().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)}_maximumFeaturesForTile(e){const t=e.hasPreciseFeatureCount?e.numFeatures:1/0,s=e.hasPreciseFeatureCount?t:this.maximumNumberOfFeatures,i=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(s*i/(1-e.emptyFeatureRatio)),t)}get test(){}};function Q(e){return"dummy-tile-full-extent"===e.id}function N(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 S(e){e.setFeatures([],0,null,void 0),e.featuresMissing=!1}function L(e){return null==e?new Set:new Set(e.map((e=>e.name)))}function k(e,t){if(null==e||null==t)return L(t);const s=new Set;for(const{name:i}of t)e.has(i)&&s.add(i);return s}function H(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,"hasAllFeatures",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 Z=2e3,V=m(),G=m(),B=m(),X=6e5,$=200;export{q as FeatureTileFetcher3D};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{isLayerWithFlowRenderer as r}from"../../../layers/support/layerUtils.js";function t(t){return r(t.layer)}export{t as isLayerViewWithFlowRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{OverlayContent as e}from"./OverlayContent.js";import{OverlayFramebufferObject as r}from"./OverlayFramebufferObject.js";import{ColorFormat as o}from"../webgl/formats.js";import{ShaderOutput as t}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{olidEnabled as l}from"../webgl-engine/effects/geometry/olidUtils.js";class s{constructor(e,t,l,s,i=o.RGBA_MIPMAP){this.output=l,this.content=s,this.fbo=new r(e,i,t)}get valid(){return this.fbo.valid}}class i{constructor(r){this.targets=[new s(r,"overlay color",t.Color,e.Color),new s(r,"overlay IM color",t.Color,e.ColorNoRasterImage),new s(r,"overlay highlight",t.Highlight,e.Highlight,o.
|
|
5
|
+
import{OverlayContent as e}from"./OverlayContent.js";import{OverlayFramebufferObject as r}from"./OverlayFramebufferObject.js";import{ColorFormat as o}from"../webgl/formats.js";import{ShaderOutput as t}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{olidEnabled as l}from"../webgl-engine/effects/geometry/olidUtils.js";class s{constructor(e,t,l,s,i=o.RGBA_MIPMAP){this.output=l,this.content=s,this.fbo=new r(e,i,t)}get valid(){return this.fbo.valid}}class i{constructor(r){this.targets=[new s(r,"overlay color",t.Color,e.Color),new s(r,"overlay IM color",t.Color,e.ColorNoRasterImage),new s(r,"overlay highlight",t.Highlight,e.Highlight,o.RG8UI),new s(r,"overlay water",t.Normal,e.WaterNormal),new s(r,"overlay occluded",t.Color,e.Occluded)],l()&&this.targets.push(new s(r,"overlay olid",t.ObjectAndLayerIdColor,e.ObjectAndLayerIdColor,o.RGBA))}getTexture(e){return this.targets[e]?.fbo.texture}dispose(){for(const e of this.targets)e.fbo.dispose()}computeValidity(){return this.targets.reduce(((e,r,o)=>r.valid?e|=1<<o:e),0)}}export{i as OverlayRenderTargets,s as RenderTargetDescriptor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as t}from"../../../core/MapUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import i from"../../../core/PooledArray.js";import{watch as n,syncAndInitial as o,on as a,initial as h}from"../../../core/reactiveUtils.js";import{someSet as l}from"../../../core/SetUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{ortho as u,fromTranslation as p}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{i as g}from"../../../chunks/vec32.js";import{ones as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DrapeTargetType as m,DrapeSourceType as y,DrapedRenderGroup as f}from"../layers/interfaces.js";import{debugFlags as R}from"../support/debugFlags.js";import{OverlayIndex as b}from"./interfaces.js";import{Overlay as T}from"./Overlay.js";import{OverlayContent as w}from"./OverlayContent.js";import{OverlayRenderTargets as D}from"./OverlayRenderTargets.js";import v from"../webgl/RenderCamera.js";import{ShaderOutput as x}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as O}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as S}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as C}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as E,renderHighlightBuffer as P}from"../webgl-engine/effects/highlight/Highlight.js";import{RenderRequestType as j}from"../webgl-engine/lib/basicInterfaces.js";import{GLMaterialRepository as A}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as M}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderOccludedFlag as W}from"../webgl-engine/lib/Material.js";import{OITPass as I}from"../webgl-engine/lib/OITPass.js";import{OverlayRenderContext as q,defaultRenderOccludedMask as N}from"../webgl-engine/lib/RenderContext.js";import{RenderSlot as F}from"../webgl-engine/lib/RenderSlot.js";import{ShadowMap as L}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as V}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as H}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{Update as G}from"../webgl-engine/lib/Update.js";import{UpdatePolicy as k}from"../webgl-engine/lib/UpdatePolicy.js";import{AmbientLight as U}from"../webgl-engine/lighting/Lightsources.js";import{O as B}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as z}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as Y,noBudget as X}from"../../support/Scheduler.js";import{FramebufferBit as K,TextureSamplingMode as J}from"../../webgl/enums.js";import{Texture as Q}from"../../webgl/Texture.js";import{TextureDescriptor as Z}from"../../webgl/TextureDescriptor.js";let $=class extends C{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new B,this.hasHighlights=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new i,this._passParameters=new S,this._materials=null,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new v,this.events=new r,this.longitudeCyclical=null,this.produces=new Map([[F.DRAPED_MATERIAL,e=>e!==x.Highlight||this.hasHighlights],[F.DRAPED_WATER,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1}initialize(){const e=this._view,r=e._stage,t=r.renderer.fboCache,{waterTextures:s,textures:i}=r.renderView;this._renderContext=new q(this._rctx,new L(t,e.state.viewingMode)),this.addHandles([n((()=>s.updating),(()=>this.events.emit("content-changed")),o),n((()=>this.spatialReference),(e=>this._localOriginFactory=new M(e)),o),a((()=>e.allLayerViews),"after-changes",(()=>this._sortedDrapeSourceRenderersDirty=!0)),n((()=>E(e.state.highlights)),(()=>this._sortedDrapeSourceRenderersDirty=!0),h),n((()=>e.state.highlights),(r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap,this._updateHighlights()}),h),e.resourceController.scheduler.registerTask(Y.STAGE,this)]),this._materials=new A(i,this._techniques,(()=>{this.notifyChange("rendersOccludedDraped"),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")}),(()=>this.events.emit("content-changed")));const{_bindParameters:l,_camera:d}=this;d.near=1,d.far=1e4,d.relativeElevation=null,l.slot=F.DRAPED_MATERIAL,l.mainDepth=null,l.camera=d,l.oitPass=I.NONE,l.updateLighting([new U(_())],0,0,G.Immediate)}destroy(){this._renderers.forEach((e=>e.destroy())),this._renderers.clear(),this._passParameters.texture=s(this._passParameters.texture),this.disposeOverlays()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view._stage}get spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}get pluginContext(){return this._pluginContext}initializeRenderContext(e){this._pluginContext=e,this._techniques.precompile(z)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,(e=>e.updating))}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),this._sortedRenderers.map((e=>e.drapeSource.layer)).filter((e=>!!e))}_updateHighlights(){const e=this._view.state;this._renderers.forEach((r=>r.updateHighlights(e.highlightOrderMap)))}createDrapeSourceRenderer(e,r,t){const s=this._renderers.get(e);null!=s&&s.destroy();const i=new r({...t,rendererContext:this,drapeSource:e});return this._renderers.set(e,i),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(n((()=>e.fullOpacity),(()=>this.events.emit("content-changed"))),e),i}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(){this._renderTargets?.dispose()}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&l(e,(e=>e.drapeTargetType===m.WithoutRasterImage))}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=l(e,(e=>e.drapeSourceType===y.Features)),this._hasDrapedRasterSource=l(e,(e=>e.drapeSourceType===y.RasterImage))):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new D(this._stage.renderer.fboCache),this._overlays=[new T,new T]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets=s(this._renderTargets),this.events.emit("textures-disposed")}getTexture(e){if(null!=e)return e===w.ColorNoRasterImage&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource?this._renderTargets?.getTexture(w.Color):this._renderTargets?.getTexture(e)}get running(){return this.updating}runTask(e){this._processDrapeSources(e,(()=>!0))}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges(this._view.state.highlightOrderMap)&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers()),s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this.hasHighlights=t(this._renderers,(e=>e.hasHighlights)),this.notifyChange("rendersOccludedDraped"))}hasHighlight(e){return t(this._renderers,(r=>r.hasHighlight(e)))}processSyncDrapeSources(){this._processDrapeSources(X,(e=>e.updatePolicy===k.SYNC))}get isEmpty(){return!R.OVERLAY_DRAW_DEBUG_TEXTURE&&!t(this._renderers,(e=>!e.isEmpty))}get hasWater(){const e=t(this._renderers,(e=>e.hasWater));return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}get rendersOccludedDraped(){const e=this._renderContext.renderOccludedMask;this._renderContext.renderOccludedMask=se,++this._techniques.precompiling;const r=this._sortedRenderers.some((({renderer:e})=>e.precompile(this._renderContext)));return--this._techniques.precompiling,this._renderContext.renderOccludedMask=e,r}renders(e){if(R.OVERLAY_DRAW_DEBUG_TEXTURE&&e!==w.Occluded&&e!==w.Highlight)return!0;++this._techniques.precompiling;const r=this._sortedRenderers.some((({renderer:e})=>e.precompile(this._renderContext)));return--this._techniques.precompiling,r}get mode(){return this.isEmpty?O.Disabled:this.hasWater&&this.renders(w.WaterNormal)?O.EnabledWithWater:this._renderTargets?.getTexture(w.Color)?O.Enabled:O.Disabled}updateAnimation(e){let r=!1;return this._renderers.forEach((t=>r=t.updateAnimation(e)||r)),r&&this.parent.requestRender(j.BACKGROUND),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(this._renderTargets){this._bindParameters.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const e of this._renderTargets.targets){if(e.content===w.ColorNoRasterImage&&!this._needsColorWithoutRasterImage)continue;const r=e.output;this._renderContext.output=r,this._bindParameters.slot=r===x.Normal?F.DRAPED_WATER:F.DRAPED_MATERIAL,e.content===w.Occluded&&(this._renderContext.renderOccludedMask=se),this._sortedRenderers.forAll((({drapeSource:r,renderer:t})=>{e.content===w.ColorNoRasterImage&&r.drapeSourceType===y.RasterImage||t.precompile(this._renderContext)})),this._renderContext.renderOccludedMask=N}--this._techniques.precompiling}}drawOverlays(e){if(this._overlays&&this._renderTargets){for(const e of this._overlays)this.longitudeCyclical?e.setupGeometryViewsCyclical(this.longitudeCyclical):e.setupGeometryView();this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;for(const e of this._renderTargets.targets){if(e.content===w.ColorNoRasterImage&&!this._needsColorWithoutRasterImage)continue;const r=this._drawTarget(b.INNER,e),t=this._drawTarget(b.OUTER,e);(r||t)&&e.fbo.generateMipMap()}}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const n=r.output;if(this.isEmpty||n===x.Normal&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:o,_camera:a,_renderContext:h,_bindParameters:l}=this;if(a.pixelRatio=t.pixelRatio*i,h.output=n,l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,l.slot=n===x.Normal?F.DRAPED_WATER:F.DRAPED_MATERIAL,r.content===w.Occluded&&(h.renderOccludedMask=se),!this.renders(r.content))return h.renderOccludedMask=N,!1;const{resolution:d}=t,c=e===b.INNER?0:d;o.setViewport(c,0,d,d),this._bindTargetFBO(r),e===b.INNER&&(o.setClearColor(0,0,0,0),o.clear(K.COLOR));if(R.OVERLAY_DRAW_DEBUG_TEXTURE&&r.content!==w.Occluded&&r.content!==w.Highlight){this._techniques.precompile(V,ie);const r=this._techniques.get(V,ie);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,re[e]),o.bindTechnique(r,l,this._passParameters),o.screen.draw()}if(r.output===x.Highlight){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),P(o,t,{width:s,height:s},l,(()=>this._renderAllGeometry(e,r)),c)}else this._renderAllGeometry(e,r);return o.bindFramebuffer(null),h.renderOccludedMask=N,!0}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll((({drapeSource:i,renderer:n})=>{if(r.content===w.ColorNoRasterImage&&i.drapeSourceType===y.RasterImage)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&r.output===x.Color&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(z);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}}))}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.bind(this._rctx,t,r)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(K.COLOR),s}get _resolution(){return this._overlays?.[b.INNER].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers,r=e.length;this._renderers.forEach(((t,s)=>{const i=e.indexOf(s.layer),n=i>=0,o=s.renderGroup??(n?f.MapLayer:f.ViewLayer),a=r*o+(n?i:0);this._sortedRenderers.push(new ee(s,t,a))})),this._sortedRenderers.sort(((e,r)=>e.index-r.index))}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],u(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),p(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(g(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new Z(e);i.samplingMode=J.NEAREST,this._passParameters.texture=new Q(this._rctx,i,t)}get test(){}};e([d()],$.prototype,"hasHighlights",void 0),e([d()],$.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([d({constructOnly:!0})],$.prototype,"parent",void 0),e([d({readOnly:!0})],$.prototype,"_techniques",null),e([d({type:Boolean,readOnly:!0})],$.prototype,"updating",null),e([d()],$.prototype,"isEmpty",null),e([d({readOnly:!0})],$.prototype,"rendersOccludedDraped",null),$=e([c("esri.views.3d.terrain.OverlayRenderer")],$);class ee{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const re=[[1,.5,.5],[.5,.5,1]],te=-2,se=W.OccludeAndTransparent,ie=new H;ie.hasAlpha=!0;export{$ as OverlayRenderer,te as drapedZ,se as overlayRenderOccludedFlag};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as t}from"../../../core/MapUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import i from"../../../core/PooledArray.js";import{watch as n,syncAndInitial as o,on as a,initial as h}from"../../../core/reactiveUtils.js";import{someSet as l}from"../../../core/SetUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{ortho as u,fromTranslation as p}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{i as g}from"../../../chunks/vec32.js";import{ones as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DrapeTargetType as m,DrapeSourceType as y,DrapedRenderGroup as f}from"../layers/interfaces.js";import{debugFlags as R}from"../support/debugFlags.js";import{OverlayIndex as b}from"./interfaces.js";import{Overlay as T}from"./Overlay.js";import{OverlayContent as w}from"./OverlayContent.js";import{OverlayRenderTargets as D}from"./OverlayRenderTargets.js";import v from"../webgl/RenderCamera.js";import{ShaderOutput as x}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as O}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as C}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as S}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as E,renderHighlightBuffer as P}from"../webgl-engine/effects/highlight/Highlight.js";import{RenderRequestType as j}from"../webgl-engine/lib/basicInterfaces.js";import{GLMaterialRepository as A}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as M}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderOccludedFlag as W}from"../webgl-engine/lib/Material.js";import{OITPass as I}from"../webgl-engine/lib/OITPass.js";import{OverlayRenderContext as q,defaultRenderOccludedMask as L}from"../webgl-engine/lib/RenderContext.js";import{RenderSlot as F}from"../webgl-engine/lib/RenderSlot.js";import{ShadowMap as N}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as V}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as H}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{Update as G}from"../webgl-engine/lib/Update.js";import{UpdatePolicy as k}from"../webgl-engine/lib/UpdatePolicy.js";import{AmbientLight as U}from"../webgl-engine/lighting/Lightsources.js";import{O as B}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as z}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as Y,noBudget as X}from"../../support/Scheduler.js";import{FramebufferBit as K,TextureSamplingMode as J}from"../../webgl/enums.js";import{Texture as Q}from"../../webgl/Texture.js";import{TextureDescriptor as Z}from"../../webgl/TextureDescriptor.js";let $=class extends S{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new B,this.hasHighlights=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new i,this._passParameters=new C,this._materials=null,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new v,this.events=new r,this.longitudeCyclical=null,this.produces=new Map([[F.DRAPED_MATERIAL,e=>e!==x.Highlight||this.hasHighlights],[F.DRAPED_WATER,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1}initialize(){const e=this._view,r=e._stage,t=r.renderer.fboCache,{waterTextures:s,textures:i}=r.renderView;this._renderContext=new q(this._rctx,new N(t,e.state.viewingMode)),this.addHandles([n((()=>s.updating),(()=>this.events.emit("content-changed")),o),n((()=>this.spatialReference),(e=>this._localOriginFactory=new M(e)),o),a((()=>e.allLayerViews),"after-changes",(()=>this._sortedDrapeSourceRenderersDirty=!0)),n((()=>E(e.state.highlights)),(()=>this._sortedDrapeSourceRenderersDirty=!0),h),n((()=>e.state.highlights),(r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap,this._updateHighlights()}),h),e.resourceController.scheduler.registerTask(Y.STAGE,this)]),this._materials=new A(i,this._techniques,(()=>{this.notifyChange("rendersOccludedDraped"),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")}),(()=>this.events.emit("content-changed")));const{_bindParameters:l,_camera:d}=this;d.near=1,d.far=1e4,d.relativeElevation=null,l.slot=F.DRAPED_MATERIAL,l.mainDepth=null,l.camera=d,l.oitPass=I.NONE,l.updateLighting([new U(_())],0,0,G.Immediate)}destroy(){this._renderers.forEach((e=>e.destroy())),this._renderers.clear(),this._passParameters.texture=s(this._passParameters.texture),this.disposeOverlays()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view._stage}get spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}get pluginContext(){return this._pluginContext}initializeRenderContext(e){this._pluginContext=e,this._techniques.precompile(z)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,(e=>e.updating))}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),this._sortedRenderers.map((e=>e.drapeSource.layer)).filter((e=>!!e))}_updateHighlights(){const e=this._view.state;this._renderers.forEach((r=>r.updateHighlights(e.highlightOrderMap)))}createDrapeSourceRenderer(e,r,t){const s=this._renderers.get(e);null!=s&&s.destroy();const i=new r({...t,rendererContext:this,drapeSource:e});return this._renderers.set(e,i),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(n((()=>e.fullOpacity),(()=>this.events.emit("content-changed"))),e),i}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(){this._renderTargets?.dispose()}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&l(e,(e=>e.drapeTargetType===m.WithoutRasterImage))}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=l(e,(e=>e.drapeSourceType===y.Features)),this._hasDrapedRasterSource=l(e,(e=>e.drapeSourceType===y.RasterImage))):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new D(this._stage.renderer.fboCache),this._overlays=[new T,new T]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets=s(this._renderTargets),this.events.emit("textures-disposed")}getTexture(e){if(null!=e)return e===w.ColorNoRasterImage&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource?this._renderTargets?.getTexture(w.Color):this._renderTargets?.getTexture(e)}get running(){return this.updating}runTask(e){this._processDrapeSources(e,(()=>!0))}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges(this._view.state.highlightOrderMap)&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers()),s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this.hasHighlights=t(this._renderers,(e=>e.hasHighlights)),this.notifyChange("rendersOccludedDraped"))}hasHighlight(e){return t(this._renderers,(r=>r.hasHighlight(e)))}processSyncDrapeSources(){this._processDrapeSources(X,(e=>e.updatePolicy===k.SYNC))}get isEmpty(){return!R.OVERLAY_DRAW_DEBUG_TEXTURE&&!t(this._renderers,(e=>!e.isEmpty))}get hasWater(){const e=t(this._renderers,(e=>e.hasWater));return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}get rendersOccludedDraped(){const e=this._renderContext.renderOccludedMask;this._renderContext.renderOccludedMask=se,++this._techniques.precompiling;const r=this._sortedRenderers.some((({renderer:e})=>e.precompile(this._renderContext)));return--this._techniques.precompiling,this._renderContext.renderOccludedMask=e,r}renders(e){if(R.OVERLAY_DRAW_DEBUG_TEXTURE&&e!==w.Occluded&&e!==w.Highlight)return!0;++this._techniques.precompiling;const r=this._sortedRenderers.some((({renderer:e})=>e.precompile(this._renderContext)));return--this._techniques.precompiling,r}get mode(){return this.isEmpty?O.Disabled:this.hasWater&&this.renders(w.WaterNormal)?O.EnabledWithWater:this._renderTargets?.getTexture(w.Color)?O.Enabled:O.Disabled}updateAnimation(e){let r=!1;return this._renderers.forEach((t=>r=t.updateAnimation(e)||r)),r&&this.parent.requestRender(j.BACKGROUND),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(this._renderTargets){this._bindParameters.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const e of this._renderTargets.targets){if(e.content===w.ColorNoRasterImage&&!this._needsColorWithoutRasterImage)continue;const r=e.output;this._renderContext.output=r,this._bindParameters.slot=r===x.Normal?F.DRAPED_WATER:F.DRAPED_MATERIAL,e.content===w.Occluded&&(this._renderContext.renderOccludedMask=se),this._sortedRenderers.forAll((({drapeSource:r,renderer:t})=>{e.content===w.ColorNoRasterImage&&r.drapeSourceType===y.RasterImage||t.precompile(this._renderContext)})),this._renderContext.renderOccludedMask=L}--this._techniques.precompiling}}drawOverlays(e){if(this._overlays&&this._renderTargets){for(const e of this._overlays)this.longitudeCyclical?e.setupGeometryViewsCyclical(this.longitudeCyclical):e.setupGeometryView();this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;for(const e of this._renderTargets.targets){if(e.content===w.ColorNoRasterImage&&!this._needsColorWithoutRasterImage)continue;const r=this._drawTarget(b.INNER,e),t=this._drawTarget(b.OUTER,e);(r||t)&&e.fbo.generateMipMap()}}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n}=r;if(this.isEmpty||n===x.Normal&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:o,_camera:a,_renderContext:h,_bindParameters:l}=this;if(a.pixelRatio=t.pixelRatio*i,h.output=n,l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,l.slot=n===x.Normal?F.DRAPED_WATER:F.DRAPED_MATERIAL,r.content===w.Occluded&&(h.renderOccludedMask=se),!this.renders(r.content))return h.renderOccludedMask=L,!1;const{resolution:d}=t,c=e===b.INNER,u=c?0:d;if(o.setViewport(u,0,d,d),this._bindTargetFBO(r),c)if(r.output!==x.Highlight)o.setClearColor(0,0,0,0),o.clear(K.COLOR);else{const{gl:e}=o;e.clearBufferuiv(e.COLOR,0,[0,0,0,0])}if(R.OVERLAY_DRAW_DEBUG_TEXTURE&&r.content!==w.Occluded&&r.content!==w.Highlight){this._techniques.precompile(V,ie);const r=this._techniques.get(V,ie);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,re[e]),o.bindTechnique(r,l,this._passParameters),o.screen.draw()}if(r.output===x.Highlight){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),P(o,t,{width:s,height:s},l,(()=>this._renderAllGeometry(e,r)),u)}else this._renderAllGeometry(e,r);return o.bindFramebuffer(null),h.renderOccludedMask=L,!0}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll((({drapeSource:i,renderer:n})=>{if(r.content===w.ColorNoRasterImage&&i.drapeSourceType===y.RasterImage)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&r.output===x.Color&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(z);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}}))}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.bind(this._rctx,t,r)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(K.COLOR),s}get _resolution(){return this._overlays?.[b.INNER].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers,r=e.length;this._renderers.forEach(((t,s)=>{const i=e.indexOf(s.layer),n=i>=0,o=s.renderGroup??(n?f.MapLayer:f.ViewLayer),a=r*o+(n?i:0);this._sortedRenderers.push(new ee(s,t,a))})),this._sortedRenderers.sort(((e,r)=>e.index-r.index))}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],u(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),p(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(g(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new Z(e);i.samplingMode=J.NEAREST,this._passParameters.texture=new Q(this._rctx,i,t)}get test(){}};e([d()],$.prototype,"hasHighlights",void 0),e([d()],$.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([d({constructOnly:!0})],$.prototype,"parent",void 0),e([d({readOnly:!0})],$.prototype,"_techniques",null),e([d({type:Boolean,readOnly:!0})],$.prototype,"updating",null),e([d()],$.prototype,"isEmpty",null),e([d({readOnly:!0})],$.prototype,"rendersOccludedDraped",null),$=e([c("esri.views.3d.terrain.OverlayRenderer")],$);class ee{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const re=[[1,.5,.5],[.5,.5,1]],te=-2,se=W.OccludeAndTransparent,ie=new H;ie.hasAlpha=!0;export{$ as OverlayRenderer,te as drapedZ,se as overlayRenderOccludedFlag};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{disposeMaybe as r,releaseMaybe as s}from"../../../core/maybe.js";import{watch as o,sync as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{set as c,copy as u}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as l}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{disposeMaybe as r,releaseMaybe as s}from"../../../core/maybe.js";import{watch as o,sync as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{set as c,copy as u}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as l}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as m,isGroupLayer as d}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as h}from"../support/flowUtils.js";import{BlendLayersPassParameters as f}from"./BlendLayersTechnique.js";import{TextureUpdate as _}from"./interfaces.js";import{LayerClass as T}from"./LayerClass.js";import{NeighborIndex as y}from"./NeighborIndex.js";import{isImageWithType as g}from"./TerrainData.js";import{isBlendableLayerView as b,isVectorTileLayerView as x,isVectorTileRenderInfo as I,isImageryTileRenderInfo as w,isImageSourceRenderInfo as A,isTextureTileRenderInfo as j,isVectorTilePerLayerInfo as P}from"./terrainUtils.js";import{ActivationTime as C}from"./TextureFader.js";import{TextureReference as O}from"./TextureReference.js";import{TileCompositor as k}from"./TileCompositor.js";import{TileRenderInfo as E}from"./TileRenderInfo.js";import L from"./TileTexture.js";import{TileUpdate as R}from"./TileUpdate.js";import{fallsWithinLayerView as M}from"./tileUtils.js";import{blendModeFromString as D}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BlendLayersOutput as N}from"../webgl-engine/core/shaderLibrary/terrain/BlendLayersOutput.js";import{createEmptyTexture as B}from"../webgl-engine/lib/glUtil3D.js";import{isCompressible as U}from"../webgl-engine/lib/TextureCompressionWorkerHandle.js";import{TextureSamplingMode as S,TextureWrapMode as G,PixelFormat as v}from"../../webgl/enums.js";import{Texture as F}from"../../webgl/Texture.js";import{TextureDescriptor as H}from"../../webgl/TextureDescriptor.js";class q{constructor(e,t,r,s,o,i){this.start=e,this.end=t,this.blendMode=r,this.opacity=s,this.output=o,this.baseOpacity=i}}let z=class extends t{constructor(e){super(e),this._passParameters=new f,this._backgroundTexture=null,this._backgroundColor=null,this._backgroundDirty=!1}initialize(){this._maxAnisotropy=this.rctx.parameters.maxMaxAnisotropy,this._compositor=new k(this.rctx,this.techniques),this._ensureBackgroundTexture(this.tileSize),this.texturesBeingCompressed=0}dispose(){this._compositor=r(this._compositor),this._backgroundTexture=s(this._backgroundTexture)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;const r=e.surface,s=r.baseOpacity;let o=0,i=0,a=this.tileSize,n=!1,c=!1;const u=r.view.state.contentPixelRatio;let p=!1;K.clear(),Q.length=0;const l=e.layerInfo[T.MAP];let f=0,y=null;for(;f<l.length;f++){const t=r.layerViewByIndex(f,T.MAP),_=t.layer,g=!M(e,t),I=_.opacity,w=t.fullOpacity;if(c=c||m(_),h(t))continue;if(b(t)){let e="normal"!==t.layer.blendMode;if(d(_.parent)){const t=_.parent.uid;null!=t&&""!==t&&(e=W(_.parent)||e)}e&&(p=e,n=!1)}if((g||0===I)&&!p){l[f].pendingUpdates&=~(R.TEXTURE_NOFADING&R.TEXTURE_FADING);continue}++i;const A=x(t),j=V(e,f,A);if(j){if(l[f].pendingUpdates&=~(R.TEXTURE_NOFADING&R.TEXTURE_FADING),d(_.parent)){const e=_.parent.uid;null!=e&&""!==e&&$(_.parent,f)}A?a=Math.max(a,this.tileSize*u):1===s&&1===w&&(t.isOpaque||this._dataToTexture(j)&&j.sourceLayerInfo.data.descriptor.isOpaque)&&(n=!0),++o,null===y&&(y=f)}}const g=a/this.tileSize,I=this._ensureBackgroundTexture(this.tileSize);0!==o&&null!==y?1===o&&!p&&this._useLayerTexture(e,y)||this._composeLayers(e,t,f-1,c,a,g,!n||p,K,p):J(e,i,I,t!==_.FADING)}_ensureBackgroundTexture(e){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(e,!1),this._backgroundDirty=!0),this._backgroundDirty&&(this._compositor.bind(e),this._passParameters.offset=p,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.drawBackground(this._passParameters,null!=this.backgroundColor),this._compositor.copyFBOToTexture(this._backgroundTexture),this._compositor.unbind(),this._backgroundDirty=!1),this._backgroundTexture}_useLayerTexture(e,t){const r=e.surface.layerViewByIndex(t,T.MAP),s=m(r.layer),o=s?e.surface.baseOpacity:1,i=s?1:e.surface.baseOpacity,a=r.fullOpacity,n=V(e,t,!1);return!!this._dataToTexture(n)&&(e.renderData.setTextureReference(new O(n.sourceLayerInfo.data,_.FADING,l(n.offset[0],n.offset[1],n.scale,n.scale),o,i,a)),!0)}_composeLayers(e,t,r,s,o,i,a,n,c){this._compositor.ensureBuffer(o);const u=e.surface.baseOpacity;let l=!1,d=S.LINEAR_MIPMAP_LINEAR,h=!1,f=0;for(let A=r;A>=0;A--){const t=e.surface.layerViewByIndex(A,T.MAP),r=t.layer,_=x(t),y=V(e,A,_),g=r.opacity,j=!M(e,t);if(!y||(0===g||j)&&!c)continue;const P=!m(r)&&!l;P&&(l=!0);let C=!1;n.forEach((e=>{e.start===A&&(e.output=s?N.Composite:a&&P?this.backgroundIsGrid?N.GridComposite:N.ColorComposite:N.Composite,e.baseOpacity=P?u:1,Q.push(e),this._compositor.openGroup(o),C=!0)}));const O=0===f,k=C?N.GroupBackgroundComposite:a&&O?this.backgroundIsGrid?N.GridComposite:N.ColorComposite:N.Composite,E=D[b(t)?t.layer.blendMode:"normal"];for(this._passParameters.baseOpacity=P&&!C&&u<1?u:1,this._passParameters.opacity=g,I(y)?h=this._compositor.drawVectorData(this._passParameters,k,o,E,y,i,this.tileSize,h):w(y)?(this._compositor.drawRasterData(this._passParameters,k,o,E,y),X(y)&&(d=S.NEAREST)):this._dataToTexture(y)&&(this._passParameters.texture=y.sourceLayerInfo.data.texture,this._passParameters.offset=y.offset,this._passParameters.scale=y.scale,this._compositor.drawImageData(this._passParameters,k,o,E));Q.length>0&&Q[Q.length-1].end===A;){const e=Q.pop();this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=p,this._passParameters.scale=1,this._compositor.drawGroup(this._passParameters,e.output,o,D[e.blendMode])}f++}const _=e.renderData,y=c||l&&u<1,g=_.ensureTexture(o,y,t,(()=>this._buildTexture(o,y,d)));this._compositor.copyFBOToTexture(g),this._compositor.unbind(),_.setTextureReference(new O(g,t,Z,l?1:u,0,1))}_dataToTexture(e){if(A(e)){const t=e.sourceLayerInfo,r=1===e.scale;t.data=this._buildTexture(t.data,!0,r),e.tile.setMemoryDirty()}return j(e)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundDirty=!0)}_buildTexture(e,t,r=S.LINEAR_MIPMAP_LINEAR){if(null==e)return null;const s=new H;s.wrapMode=G.CLAMP_TO_EDGE,s.samplingMode="boolean"==typeof r?S.LINEAR_MIPMAP_LINEAR:r,s.maxAnisotropy=this._maxAnisotropy,s.preMultiplyAlpha=!0,s.flipped=!0,s.hasMipmap=!0,t||(s.pixelFormat=v.RGB);const o=this.rctx,i="boolean"==typeof r&&r;let a;if("number"==typeof e)s.width=s.height=e,a=this._buildTileTexture(s,e);else if(g(e))s.isOpaque=e.isOpaque,s.isOpaque&&(s.pixelFormat=v.RGB),a=this._buildTileTexture(s,e.element.width,i,e.element);else try{s.width=e.width,s.height=e.height,a=this._buildTileTexture(s,e.width,i,e)}catch(c){a=new L(B(o)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const n=o.bindTexture(a.texture,F.TEXTURE_UNIT_FOR_UPDATES);return a.generateMipmap(),o.bindTexture(n,F.TEXTURE_UNIT_FOR_UPDATES),a}_buildTileTexture(e,t,r=!1,s){const a=`${t} ${e.pixelFormat}`,n=this.cache.pop(a)??this.cache.pop(a+"compressed");if(r&&=U(s),n)return n.retain(),r&&n.texture.enableCompression(!0),n.texture.setData(s),n;e.shouldCompress=r;const c=new F(this.rctx,e,s);return c.isCompressing&&(this.texturesBeingCompressed++,this.addHandles([o((()=>c.isCompressing),(e=>{e?this.texturesBeingCompressed++:this.texturesBeingCompressed--}),i)])),new L(c,this.cache)}get test(){}};function V(e,t,r){Y.layerIndex=t,Y.vtlNeighborInfos.clear();const s=e.layerInfo[T.MAP][t];if(c(Y.offset,0,0),Y.tile=e,Y.scale=1,Y.sourceLod=e.lij,Y.sourceLayerInfo=s,Y.isVTLBackground=r,s.data)return r&&e.forEachLoadedNeighbor(((r,o)=>{if(r.level!==e.level)return;const i=r.layerInfo[T.MAP][t];if(!P(i)||s.data===i.data)return;const a=Y.vtlNeighborInfos.pushNew();a.offset=ee[o],a.sourceLod=r.lij,a.sourceLayerInfo=i})),Y;const o=s.upsampleInfo,i=o?.tile?.layerInfo[T.MAP][t];return i&&o.tile?(Y.tile=o.tile,u(Y.offset,o.offset),Y.scale=o.scale,Y.sourceLod=o.tile.lij,Y.sourceLayerInfo=i,Y):r?Y:null}function X(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}function W(e){let t="normal"!==e.blendMode;return d(e.parent)&&(t=W(e.parent)||t),t}function $(e,t){d(e.parent)&&$(e.parent,t);const r=e.uid;if(null!=r&&""!==r){const s=K.get(r);s?s.start=t:K.set(r,new q(t,t,e.blendMode,e.opacity,N.Composite,1))}}function J(e,t,r,s){const o=e.renderData,i=!s&&null!=o.textureReference&&(e.surface.view.layerViewManager.updating||t>0)?C.Delayed:C.Immediate;o.setTextureReference(new O(r,_.FADING,Z,e.surface.baseOpacity,0,1),i)}e([a({constructOnly:!0})],z.prototype,"rctx",void 0),e([a({constructOnly:!0})],z.prototype,"techniques",void 0),e([a({constructOnly:!0})],z.prototype,"cache",void 0),e([a()],z.prototype,"tileSize",void 0),e([a()],z.prototype,"texturesBeingCompressed",void 0),z=e([n("esri.views.3d.terrain.TileRenderer")],z);const K=new Map,Q=new Array,Y=new E,Z=l(0,0,1,1),ee=new Array;ee[y.NORTH]=[0,-1],ee[y.NORTH_EAST]=[-1,-1],ee[y.EAST]=[-1,0],ee[y.SOUTH_EAST]=[-1,1],ee[y.SOUTH]=[0,1],ee[y.SOUTH_WEST]=[1,1],ee[y.WEST]=[1,0],ee[y.NORTH_WEST]=[1,-1];export{q as GroupInfo,z as TileRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{someMap as t}from"../../../core/MapUtils.js";import{releaseMaybe as e}from"../../../core/maybe.js";import{RenderCategory as h}from"../webgl.js";import{isManagedDepthTexture as r}from"./ManagedDepthTexture.js";import{ManagedFBObject as s,AttachmentType as o}from"./ManagedFBObject.js";import{DepthStencilAttachment as i,
|
|
5
|
+
import{someMap as t}from"../../../core/MapUtils.js";import{releaseMaybe as e}from"../../../core/maybe.js";import{RenderCategory as h}from"../webgl.js";import{isManagedDepthTexture as r}from"./ManagedDepthTexture.js";import{ManagedFBObject as s,AttachmentType as o}from"./ManagedFBObject.js";import{DepthStencilAttachment as i,ColorAttachment0 as a}from"../../webgl/enums.js";class c extends s{constructor(t,e,r,s,i,a){super(t,a),this.type=o.FBO,this._colors=new Map,this._name=h.COMPOSITE,this.acquireDepth=null,this.acquireColor=null,this._name=e,this.fbo=r,this.acquireDepth=s,this.acquireColor=i}dispose(){this.fbo?.dispose()}get cachedMemory(){return this.fbo?.usedMemory||0}get numberOfColorAttachments(){return this._colors.size}get name(){return this._name}setName(t){this._name=t}getTexture(t=a){return t===i?this.fbo?.depthStencilTexture:this.fbo?.getColorTexture(t)}getAttachment(t=a){return t===i?this._depth:this._colors.get(t)}hasAttachment(e){return t(this._colors,(t=>t.name===e))}attachDepth(t){return t?.retain(),this.detachDepth(),t&&this.fbo?.attachDepthStencil(t.attachment),this._depth=t,this}detachDepth(){this.fbo?.detachDepthStencilTexture(),this.fbo?.detachDepthStencilBuffer(),this._depth=e(this._depth)}obtainDepthTexture(){const t=this._depth;return r(t)?(this.fbo?.detachDepthStencilTexture(),this._depth=null,t):null}attachColor(t,e){return t.retain(),this.detachColor(e),this.fbo?.attachColorTexture(t.attachment,e),this._colors.set(e,t),this}detachColor(t){this.fbo?.detachColorTexture(t);const e=this._colors.get(t);this._colors.delete(t),e?.release()}detachAll(){this._colors.forEach(((t,e)=>this.detachColor(e))),this.detachDepth()}}export{c as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
var R,E;!function(R){R[R.RED=0]="RED",R[R.
|
|
5
|
+
var R,E;!function(R){R[R.RED=0]="RED",R[R.R8UI=1]="R8UI",R[R.RG=2]="RG",R[R.RG8UI=3]="RG8UI",R[R.RGBA4=4]="RGBA4",R[R.RGBA=5]="RGBA",R[R.RGBA_MIPMAP=6]="RGBA_MIPMAP",R[R.R16F=7]="R16F",R[R.RGBA16F=8]="RGBA16F"}(R||(R={})),function(R){R[R.DEPTH_STENCIL_TEXTURE=0]="DEPTH_STENCIL_TEXTURE",R[R.DEPTH16_BUFFER=1]="DEPTH16_BUFFER"}(E||(E={}));export{R as ColorFormat,E as DepthFormat};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import{ColorFormat as t,DepthFormat as r}from"../../webgl/formats.js";import{ManagedColorAttachment as a}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthAttachment as o}from"../../webgl/ManagedDepthAttachment.js";import
|
|
5
|
+
import e from"../../../../core/Error.js";import{ColorFormat as t,DepthFormat as r}from"../../webgl/formats.js";import{ManagedColorAttachment as a}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthAttachment as o}from"../../webgl/ManagedDepthAttachment.js";import i from"../../webgl/ManagedFBO.js";import{AttachmentType as n}from"../../webgl/ManagedFBObject.js";import{FBOPool as c}from"./FBOPool.js";import{PixelFormat as h,SizedPixelFormat as s,TextureWrapMode as m,TextureSamplingMode as _,PixelType as d,RenderbufferFormat as l,ColorAttachment0 as p}from"../../../webgl/enums.js";import{FramebufferObject as u}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as E}from"../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as f}from"../../../webgl/RenderbufferDescriptor.js";import{Texture as w}from"../../../webgl/Texture.js";import{TextureDescriptor as T}from"../../../webgl/TextureDescriptor.js";class C{constructor(e){this.rctx=e,this._acquired=new Set,this._cache=new c(e.newCache,"FBOCache"),this._depthCache=new c(e.newCache,"DepthAttachmentCache"),this._colorCache=new c(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.()}frameEnd(){const e=this.debugCallback;e&&this._acquired.forEach((t=>t.type===n.FBO&&e(t.name,t.fbo,t.numberOfColorAttachments)))}get usedMemory(){return Array.from(this._acquired.values()).reduce(((e,t)=>e+("getTexture"in t?t.getTexture()?.usedMemory??0:t.cachedMemory)),this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e}acquire(a,o,n,c=t.RGBA){const h=R(c,a,o);let s=this._cache.pop(h);if(s){s.retain(),s.setName(n);const t=this.rctx.getBoundFramebufferObject();if(this.rctx.bindFramebuffer(s.fbo),this.rctx.setDrawBuffers([p]),!s.fbo)throw new e("attempt to use a not existing framebuffer");this.rctx.unbindTexture(s.fbo.colorTexture),this.rctx.bindFramebuffer(t)}else s=new i(h,n,new u(this.rctx,{...P[c],width:a,height:o}),(e=>{e??=r.DEPTH_STENCIL_TEXTURE;const t=this._acquireDepth(e,s.fbo.width,s.fbo.height,`${s.name} depth`);return s.attachDepth(t),t.release(),s}),((e,r,i)=>{r??=t.RGBA;const n=this._acquireColor(r,a,o,i??`${s.name} color ${e}`);return this.rctx.unbindTexture(n.attachment),s.attachColor(n,e),n.release(),s}),(()=>{this.debugCallback?.(s.name,s.fbo,s.numberOfColorAttachments),this._acquired.delete(s),s.detachAll(),this._cache.put(s)}));return this._trackHandle(s)}acquireDepth(e,t,r,a){return this._acquireDepth(e,t,r,a)}_acquireDepth(e,t,a,i){const n=R(e,t,a),c=this._depthCache.pop(n);if(c)return c.retain(),c.name=i,this._trackHandle(c);const h=e===r.DEPTH_STENCIL_TEXTURE?new o(n,new w(this.rctx,{...I[e],width:t,height:a}),(()=>{this._acquired.delete(h),this._depthCache.put(h)})):new o(n,new E(this.rctx,{...I[e],width:t,height:a}),(()=>{this._acquired.delete(h),this._depthCache.put(h)}));return h.name=i,this._trackHandle(h)}_acquireColor(e,t,r,o){const i=R(e,t,r),n=this._colorCache.pop(i);if(n)return n.retain(),n.name=o,this._trackHandle(n);const c=new a(i,new w(this.rctx,{...P[e],width:t,height:r}),(()=>{this._acquired.delete(c),this._colorCache.put(c)}));return c.name=o,this._trackHandle(c)}_trackHandle(e){return this._acquired.add(e),e}}const b=new i("default","default",null,(()=>b),(()=>b),(()=>{}));function R(e,t,r){return`${e}x${t}x${r}`}b.release=()=>!1;const A=new T;A.pixelFormat=h.RED,A.internalFormat=s.R8,A.wrapMode=m.CLAMP_TO_EDGE;const M=new T;M.pixelFormat=h.RED_INTEGER,M.internalFormat=s.R8UI,M.wrapMode=m.CLAMP_TO_EDGE,M.samplingMode=_.NEAREST;const g=new T;g.pixelFormat=h.RG,g.internalFormat=s.RG8,g.wrapMode=m.CLAMP_TO_EDGE;const F=new T;F.pixelFormat=h.RG_INTEGER,F.internalFormat=s.RG8UI,F.wrapMode=m.CLAMP_TO_EDGE,F.samplingMode=_.NEAREST;const D=new T;D.internalFormat=s.RGBA4,D.dataType=d.UNSIGNED_SHORT_4_4_4_4,D.wrapMode=m.CLAMP_TO_EDGE;const x=new T;x.wrapMode=m.CLAMP_TO_EDGE;const G=new T;G.wrapMode=m.CLAMP_TO_EDGE,G.samplingMode=_.LINEAR_MIPMAP_LINEAR,G.hasMipmap=!0,G.maxAnisotropy=8;const N=new T;N.pixelFormat=h.RED,N.dataType=d.HALF_FLOAT,N.internalFormat=s.R16F,N.samplingMode=_.NEAREST;const O=new T;O.dataType=d.HALF_FLOAT,O.internalFormat=s.RGBA16F,O.samplingMode=_.NEAREST;const P={[t.RED]:A,[t.R8UI]:M,[t.RG]:g,[t.RG8UI]:F,[t.RGBA4]:D,[t.RGBA]:x,[t.RGBA_MIPMAP]:G,[t.R16F]:N,[t.RGBA16F]:O},L=new T;L.pixelFormat=h.DEPTH_STENCIL,L.dataType=d.UNSIGNED_INT_24_8,L.samplingMode=_.NEAREST,L.wrapMode=m.CLAMP_TO_EDGE,L.internalFormat=h.DEPTH24_STENCIL8;const I={[r.DEPTH_STENCIL_TEXTURE]:L,[r.DEPTH16_BUFFER]:new f(l.DEPTH_COMPONENT16,4)};export{C as FBOCache,b as defaultWebGLFBO};
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{set as e}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{glsl as i}from"../shaderModules/glsl.js";import{Integer2PassUniform as t}from"../shaderModules/Integer2PassUniform.js";import{IntegerPassUniform as o}from"../shaderModules/IntegerPassUniform.js";import{
|
|
5
|
+
import{set as e}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{glsl as i}from"../shaderModules/glsl.js";import{Integer2PassUniform as t}from"../shaderModules/Integer2PassUniform.js";import{IntegerPassUniform as o}from"../shaderModules/IntegerPassUniform.js";import{UintTexture2DPassUniform as n}from"../shaderModules/UintTexture2DPassUniform.js";import{g as c}from"../../../../../chunks/HighlightDownsample.glsl.js";function s(l){const{vertex:s}=l;s.uniforms.add(new n("coverageTexture",(e=>e.coverageTexture)),new t("highlightRenderCellCount",(l=>e(r,l.horizontalCellCount,l.verticalCellCount))),new t("highlightTextureResolution",(({highlightTexture:l})=>e(r,l.descriptor.width,l.descriptor.height))),new o("highlightLevel",(e=>e.highlightLevel))).constants.add("cellSize","int",c),l.varyings.add("sUV","vec2"),l.varyings.add("vOutlinePossible","float"),s.code.add(i`const ivec2 cellVertices[4] = ivec2[4](ivec2(0,0), ivec2(1,0), ivec2(0,1), ivec2(1,1));`),s.main.add(i`int cellIndex = gl_InstanceID;
|
|
6
6
|
int cellX = cellIndex % highlightRenderCellCount[0];
|
|
7
7
|
int cellY = (cellIndex - cellX) / highlightRenderCellCount[0];
|
|
8
8
|
ivec2 cellPos = ivec2(cellX, cellY);
|
|
9
|
-
uvec2 covTexel =
|
|
9
|
+
uvec2 covTexel = texelFetch(coverageTexture, cellPos, 0).rg;
|
|
10
10
|
int channelIndex = (highlightLevel >> 2) & 3;
|
|
11
11
|
uint channelValue = covTexel[channelIndex];
|
|
12
12
|
int highlightIndex = (highlightLevel & 3) << 1;
|
|
@@ -6,10 +6,10 @@ import{glsl as e}from"../shaderModules/glsl.js";function l(l){const{fragment:t}=
|
|
|
6
6
|
int llc = (highlightLevel & 3) << 1;
|
|
7
7
|
return (channel >> llc) & 3u;
|
|
8
8
|
}
|
|
9
|
-
uint readChannel(
|
|
9
|
+
uint readChannel(uvec2 texel, int highlightLevel) {
|
|
10
10
|
int lic = (highlightLevel >> 2) & 1;
|
|
11
|
-
return
|
|
11
|
+
return texel[lic];
|
|
12
12
|
}
|
|
13
|
-
uint readLevelBits(
|
|
13
|
+
uint readLevelBits(uvec2 texel, int highlightLevel) {
|
|
14
14
|
return readChannelBits(readChannel(texel, highlightLevel), highlightLevel);
|
|
15
15
|
}`)}export{l as HighlightReadBitmap};
|
|
@@ -2,96 +2,82 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{fromValues as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
return size * clamp(vvSizeOffset + value * vvSizeFactor, vvSizeMinSize, vvSizeMaxSize).xz;
|
|
16
|
-
}
|
|
17
|
-
`)):d.code.add(s`vec2 getSize(){
|
|
5
|
+
import{fromValues as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{Float2PassUniform as o}from"../../shaderModules/Float2PassUniform.js";import{Float3PassUniform as a}from"../../shaderModules/Float3PassUniform.js";import{Float4PassUniform as r}from"../../shaderModules/Float4PassUniform.js";import{Float4sPassUniform as i}from"../../shaderModules/Float4sPassUniform.js";import{FloatPassUniform as t}from"../../shaderModules/FloatPassUniform.js";import{FloatsPassUniform as v}from"../../shaderModules/FloatsPassUniform.js";import{glsl as l}from"../../shaderModules/glsl.js";import{VertexAttribute as s}from"../../../lib/VertexAttribute.js";import{vvColorNumber as c,VisualVariablePassParameters as p}from"../../../materials/VisualVariablePassParameters.js";const f=8;function n(e,p){e.attributes.add(s.POSITION,"vec3"),e.attributes.add(s.PROFILEVERTEXANDNORMAL,"vec4"),e.attributes.add(s.FEATUREVALUE,"vec4"),e.attributes.add(s.PROFILEAUXDATA,"vec2"),e.attributes.add(s.PROFILERIGHT,"vec2"),e.attributes.add(s.PROFILEUP,"vec2");const n=e.vertex;n.code.add(l`bool isCapVertex() {
|
|
6
|
+
return featureValue.w == 1.0;
|
|
7
|
+
}`),n.uniforms.add(new o("size",(e=>e.size))),p.vvSize?(n.uniforms.add(new a("vvSizeMinSize",(e=>e.vvSize.minSize)),new a("vvSizeMaxSize",(e=>e.vvSize.maxSize)),new a("vvSizeOffset",(e=>e.vvSize.offset)),new a("vvSizeFactor",(e=>e.vvSize.factor)),new a("vvSizeFallback",(e=>e.vvSize.fallback))),n.code.add(l`vec2 getSize() {
|
|
8
|
+
float value = featureValue.x;
|
|
9
|
+
if (isnan(value)) {
|
|
10
|
+
return vvSizeFallback.xz;
|
|
11
|
+
}
|
|
12
|
+
return size * clamp(vvSizeOffset + value * vvSizeFactor, vvSizeMinSize, vvSizeMaxSize).xz;
|
|
13
|
+
}`)):n.code.add(l`vec2 getSize(){
|
|
18
14
|
return size;
|
|
19
|
-
}`),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return vec4( color.xyz, vvOpacityOpacities[vvOpacityNumber - 1]);
|
|
38
|
-
}
|
|
39
|
-
`)):d.code.add(s`vec4 applyOpacity(vec4 color){
|
|
15
|
+
}`),p.vvOpacity?(n.constants.add("vvOpacityNumber","int",f),n.uniforms.add(new v("vvOpacityValues",(e=>e.vvOpacity.values),f),new v("vvOpacityOpacities",(e=>e.vvOpacity.opacityValues),f),new t("vvOpacityFallback",(e=>e.vvOpacity.fallback))),n.code.add(l`vec4 applyOpacity(vec4 color) {
|
|
16
|
+
float value = featureValue.z;
|
|
17
|
+
if (isnan(value)) {
|
|
18
|
+
return vec4(color.rgb, vvOpacityFallback);
|
|
19
|
+
}
|
|
20
|
+
if (value <= vvOpacityValues[0]) {
|
|
21
|
+
return vec4( color.xyz, vvOpacityOpacities[0]);
|
|
22
|
+
}
|
|
23
|
+
for (int i = 1; i < vvOpacityNumber; ++i) {
|
|
24
|
+
if (vvOpacityValues[i] >= value) {
|
|
25
|
+
float f = (value - vvOpacityValues[i-1]) / (vvOpacityValues[i] - vvOpacityValues[i-1]);
|
|
26
|
+
return vec4( color.xyz, mix(vvOpacityOpacities[i-1], vvOpacityOpacities[i], f));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return vec4( color.xyz, vvOpacityOpacities[vvOpacityNumber - 1]);
|
|
30
|
+
}`)):n.code.add(l`vec4 applyOpacity(vec4 color){
|
|
40
31
|
return color;
|
|
41
|
-
}`),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return applyOpacity(vvColorColors[vvColorNumber - 1]);
|
|
60
|
-
}
|
|
61
|
-
`)):d.code.add(s`vec4 getColor(){
|
|
32
|
+
}`),p.vvColor?(n.constants.add("vvColorNumber","int",c),n.uniforms.add(new v("vvColorValues",(e=>e.vvColor.values),c),new i("vvColorColors",(e=>e.vvColor.colors),c),new r("vvColorFallback",(e=>e.vvColor.fallback))),n.code.add(l`vec4 getColor() {
|
|
33
|
+
float value = featureValue.y;
|
|
34
|
+
if (isnan(value)) {
|
|
35
|
+
return applyOpacity(vvColorFallback);
|
|
36
|
+
}
|
|
37
|
+
if (value <= vvColorValues[0]) {
|
|
38
|
+
return applyOpacity(vvColorColors[0]);
|
|
39
|
+
}
|
|
40
|
+
for (int i = 1; i < vvColorNumber; ++i) {
|
|
41
|
+
if (vvColorValues[i] >= value) {
|
|
42
|
+
float f = (value - vvColorValues[i-1]) / (vvColorValues[i] - vvColorValues[i-1]);
|
|
43
|
+
return applyOpacity(mix(vvColorColors[i-1], vvColorColors[i], f));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return applyOpacity(vvColorColors[vvColorNumber - 1]);
|
|
47
|
+
}`)):n.code.add(l`vec4 getColor(){
|
|
62
48
|
return applyOpacity(vec4(1, 1, 1, 1));
|
|
63
|
-
}`),
|
|
49
|
+
}`),n.code.add(l`vec3 decompressAxis(vec2 axis) {
|
|
50
|
+
float z = 1.0 - abs(axis.x) - abs(axis.y);
|
|
51
|
+
return normalize(vec3(axis + sign(axis) * min(z, 0.0), z));
|
|
52
|
+
}
|
|
53
|
+
vec3 calculateVPos() {
|
|
64
54
|
vec2 size = getSize();
|
|
65
55
|
vec3 origin = position;
|
|
66
|
-
vec3 right = profileRight
|
|
67
|
-
vec3 up = profileUp
|
|
56
|
+
vec3 right = decompressAxis(profileRight);
|
|
57
|
+
vec3 up = decompressAxis(profileUp);
|
|
58
|
+
vec2 profileVertex = profileVertexAndNormal.xy * size;`),n.code.add(l`if(isCapVertex()) {
|
|
59
|
+
float positionOffsetAlongProfilePlaneNormal = profileAuxData.x * size[0];
|
|
68
60
|
vec3 forward = cross(up, right);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
float maxDistance = length(rotationRight);`),d.code.add(s`rotationRight = maxDistance > 0.0 ? normalize(rotationRight) : vec2(0, 0);
|
|
61
|
+
vec3 offset = right * profileVertex.x + up * profileVertex.y + forward * positionOffsetAlongProfilePlaneNormal;
|
|
62
|
+
return origin + offset;
|
|
63
|
+
}
|
|
64
|
+
vec2 rotationRight = vec2(profileAuxData.x, profileAuxData.y);
|
|
65
|
+
float maxDistance = length(rotationRight);`),n.code.add(l`rotationRight = maxDistance > 0.0 ? normalize(rotationRight) : vec2(0, 0);
|
|
75
66
|
float rx = dot(profileVertex, rotationRight);
|
|
76
67
|
if (abs(rx) > maxDistance) {
|
|
77
68
|
vec2 rotationUp = vec2(-rotationRight.y, rotationRight.x);
|
|
78
69
|
float ry = dot(profileVertex, rotationUp);
|
|
79
70
|
profileVertex = rotationRight * maxDistance * sign(rx) + rotationUp * ry;
|
|
80
71
|
}
|
|
81
|
-
|
|
82
|
-
positionOffsetAlongProfilePlaneNormal = profileRight.w * size[0];
|
|
83
|
-
normalOffsetAlongProfilePlaneNormal = profileUp.w;
|
|
84
|
-
}
|
|
85
|
-
vec3 offset = right * profileVertex.x + up * profileVertex.y + forward * positionOffsetAlongProfilePlaneNormal;
|
|
72
|
+
vec3 offset = right * profileVertex.x + up * profileVertex.y;
|
|
86
73
|
return origin + offset;
|
|
87
|
-
}`),
|
|
88
|
-
vec3 right = profileRight
|
|
89
|
-
vec3 up = profileUp
|
|
90
|
-
vec3
|
|
91
|
-
vec2 profileNormal = profileVertexAndNormal.zw;
|
|
92
|
-
vec3 normal = right * profileNormal.x + up * profileNormal.y;
|
|
74
|
+
}`),n.code.add(l`vec3 localNormal() {
|
|
75
|
+
vec3 right = decompressAxis(profileRight);
|
|
76
|
+
vec3 up = decompressAxis(profileUp);
|
|
77
|
+
vec3 normal = right * profileVertexAndNormal.z + up * profileVertexAndNormal.w;
|
|
93
78
|
if(isCapVertex()) {
|
|
94
|
-
|
|
79
|
+
vec3 forward = cross(up, right);
|
|
80
|
+
normal += forward * profileAuxData.y;
|
|
95
81
|
}
|
|
96
82
|
return normal;
|
|
97
|
-
}`)}class
|
|
83
|
+
}`)}class u extends p{constructor(){super(...arguments),this.size=e(1,1)}}export{n as PathVertexPosition,u as PathVertexPositionPassParameters};
|