@arcgis/core 4.26.0-next.20230121 → 4.26.0-next.20230123
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/applications/SceneViewer/sceneViewerUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/006af87392d7136fb8c7.js +1 -0
- package/assets/esri/core/workers/chunks/5c8fd7842bdfe912eef2.js +1 -0
- package/assets/esri/core/workers/chunks/{d75f1c8f8dcabdf32021.js → c49510a48cdf64a0d9fc.js} +1 -1
- package/assets/esri/themes/base/widgets/_Tooltip.scss +29 -2
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_en.json +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/voxel/VoxelIsosurface.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectStates.js +1 -1
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/support/SceneLayerViewRequiredFields.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/webgl-engine/lib/AppleAmdDriverHelper.js +5 -0
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/interactive/sketch/SketchTooltipVisibleElements.js +1 -1
- package/views/interactive/tooltip/DrawTooltipInfos.js +1 -1
- package/views/interactive/tooltip/SketchTooltipInfo.js +1 -1
- package/views/interactive/tooltip/content/TooltipContent.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawCircle.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawRectangle.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentExtentRotate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentExtentScale.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentReshapeEdgeOffset.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformAbsolute.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformRotate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformScale.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateGraphic.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateGraphicXY.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateGraphicZ.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertex.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertexXY.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertexZ.js +1 -1
- package/views/interactive/tooltip/css.js +1 -1
- package/views/interactive/tooltip/support/TooltipContentWithHelpMessage.js +5 -0
- package/views/webgl/WebGLDriverTest.js +1 -1
- package/views/webgl/testAppleAmdDrawArrays.js +5 -0
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile.js +1 -1
- package/assets/esri/core/workers/chunks/1363e647f3b0bca07e09.js +0 -1
- package/assets/esri/core/workers/chunks/fa52b97a76b2b4170c5d.js +0 -1
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const e="
|
|
5
|
+
const e="20230123",b="2f4ea772eeb685fec9b4ef4310a7c80e3bd44943";export{e as buildDate,b as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import i from"../../../core/Logger.js";import{isAbortError as t}from"../../../core/promiseUtils.js";import{watch as r}from"../../../core/reactiveUtils.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{equals as l}from"../../../geometry/support/spatialReferenceUtils.js";import{GraphicsCollection as h}from"../../../support/GraphicsCollection.js";import"../../../core/Error.js";import"../../../core/has.js";import"../../../core/scheduling.js";import"../../../request.js";import"../../../chunks/index2.js";import"../../../core/urlUtils.js";import"../../../chunks/index3.js";import"../../../layers/effects/EffectView.js";import"../engine/DisplayObject.js";import"../engine/webgl/effects/highlight/HighlightGradient.js";import"../engine/webgl/BufferPool.js";import"../engine/webgl/enums.js";import"../../webgl/enums.js";import"../../../chunks/vec2f32.js";import"../../../layers/support/rasterFunctions/pixelUtils.js";import"../../webgl/context-util.js";import"../../webgl/Texture.js";import"../engine/imagery/colorizer/rasterColorizer.js";import"../engine/imagery/processor/rasterProcessor.js";import"../../webgl/BufferObject.js";import"../../webgl/VertexArrayObject.js";import"../../webgl/FramebufferObject.js";import"../engine/webgl/brushes/BrushBitmap.js";import"../../../chunks/vec4f32.js";import"../engine/webgl/Utils.js";import"../engine/webgl/shaders/BackgroundPrograms.js";import"../../webgl/checkWebGLError.js";import"../../../chunks/builtins.js";import"../../../core/RandomLCG.js";import"../engine/webgl/materialKey/MaterialKey.js";import"../engine/webgl/techniques/Technique.js";import"../engine/webgl/techniques/dotDensity/TechniqueDotDensity.js";import"../engine/webgl/techniques/heatmap/TechniqueHeatmap.js";import"../engine/webgl/techniques/pieChart/TechniquePieChart.js";import"../engine/webgl/brushes/WGLBrushHeatmap.js";import"../engine/webgl/DefaultVertexAttributeLayouts.js";import"../engine/webgl/shaders/TileInfoPrograms.js";import"../engine/webgl/brushes/WGLGeometryBrushMarker.js";import"../../../core/mathUtils.js";import"../engine/webgl/number.js";import"../engine/vectorTiles/style/StyleDefinition.js";import"../engine/vectorTiles/enums.js";import"../engine/vectorTiles/shaders/sources/resolver.js";import"../engine/webgl/shaders/BitBlitPrograms.js";import"../engine/webgl/shaders/sources/resolver.js";import"../engine/webgl/TextureManager.js";import"../engine/webgl/shaders/StencilPrograms.js";import"../engine/webgl/effects/BlendEffect.js";import"../engine/webgl/shaders/HighlightPrograms.js";import"../engine/webgl/Profiler.js";import"../../webgl/renderState.js";import"../../../core/floatRGBA.js";import"../../3d/webgl-engine/lib/OrderIndependentTransparency.js";import"../../../chunks/webgl-debug.js";import"../LabelManager.js";import a from"./graphics/GraphicsView2D.js";import"../engine/webgl/AttributeStoreView.js";import"../../../chunks/earcut.js";import"../../../layers/graphics/featureConversionUtils.js";import"../../../core/unitUtils.js";import"../../../renderers/support/lengthUtils.js";import"../../../chunks/vec3f32.js";import"../../../geometry/support/normalizeUtils.js";import"../navigation/MapViewNavigation.js";import"../../../core/asyncUtils.js";import"../engine/webgl/shaders/MagnifierPrograms.js";import{BitmapTileLayerView2D as n}from"./BitmapTileLayerView2D.js";import{LayerView2DMixin as p}from"./LayerView2D.js";import g from"./graphics/HighlightGraphicContainer.js";import{createBlankImage as c,resampleImage as m}from"./support/imageUtils.js";import u from"../tiling/TileInfoView.js";import f from"../tiling/TileKey.js";import w from"../tiling/TileQueue.js";import j from"../tiling/TileStrategy.js";import d from"../../layers/LayerView.js";import y from"../../layers/RefreshableLayerView.js";import{isMapServiceLayerView as b,MapServiceLayerViewHelper as _}from"../../layers/support/MapServiceLayerViewHelper.js";import{createQueryGeometry as T}from"../../support/drapedUtils.js";const V=[0,0];let v=class extends(y(n(p(d)))){constructor(){super(...arguments),this._fetchQueue=null,this._highlightGraphics=new h,this._popupHighlightHelper=null,this._tileStrategy=null,this.layer=null}get resampling(){return!("resampling"in this.layer)||!1!==this.layer.resampling}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume()}attach(){const e="tileServers"in this.layer?this.layer.tileServers:null;this._tileInfoView=new u(this.layer.tileInfo,this.layer.fullExtent),this._fetchQueue=new w({tileInfoView:this._tileInfoView,concurrency:e&&10*e.length||10,process:(e,i)=>this.fetchTile(e,i)}),this._tileStrategy=new j({cachePolicy:"keep",resampling:this.resampling,acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView}),b(this)&&(this._highlightView=new a({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new g(this.view.featuresTilingScheme)}),this.container.addChild(this._highlightView.container),this._popupHighlightHelper=new _({createFetchPopupFeaturesQueryGeometry:(e,i)=>T(e,i,this.view),highlightGraphics:this._highlightGraphics,highlightGraphicUpdated:(e,i)=>{this._highlightView.graphicUpdateHandler({graphic:e,property:i})},layerView:this,updatingHandles:this.updatingHandles})),this.requestUpdate(),this.handles.add(r((()=>this.resampling),(()=>{this.doRefresh()}))),super.attach()}detach(){super.detach(),this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._popupHighlightHelper?.destroy(),this._fetchQueue=this._tileStrategy=this._tileInfoView=this._popupHighlightHelper=null}async fetchPopupFeatures(e,i){return this._popupHighlightHelper?this._popupHighlightHelper.fetchPopupFeatures(e,i):[]}highlight(e){return this._popupHighlightHelper?this._popupHighlightHelper.highlight(e):{remove(){}}}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return l(this.layer.tileInfo?.spatialReference,e)}async doRefresh(){!this.attached||this.updateRequested||this.suspended||(this._fetchQueue.reset(),this._tileStrategy.tiles.forEach((e=>this._enqueueTileFetch(e))))}isUpdating(){return this._fetchQueue?.updating??!1}acquireTile(e){const i=this._bitmapView.createTile(e),t=i.bitmap;return[t.x,t.y]=this._tileInfoView.getTileCoords(V,i.key),t.resolution=this._tileInfoView.getTileResolution(i.key),[t.width,t.height]=this._tileInfoView.tileInfo.size,this._enqueueTileFetch(i),this._bitmapView.addChild(i),this.requestUpdate(),i}releaseTile(e){this._fetchQueue.abort(e.key.id),this._bitmapView.removeChild(e),e.once("detach",(()=>e.destroy())),this.requestUpdate()}async fetchTile(e,i={}){const r="tilemapCache"in this.layer?this.layer.tilemapCache:null,{signal:s,resamplingLevel:o=0}=i;if(!r)try{return await this._fetchImage(e,s)}catch(a){if(!t(a)&&!this.resampling)return c(this._tileInfoView.tileInfo.size);if(o<3){const t=this._tileInfoView.getTileParentId(e.id);if(t){const r=new f(t),s=await this.fetchTile(r,{...i,resamplingLevel:o+1});return m(this._tileInfoView,s,r,e)}}throw a}const l=new f(0,0,0,0);let h;try{if(await r.fetchAvailabilityUpsample(e.level,e.row,e.col,l,{signal:s}),l.level!==e.level&&!this.resampling)return c(this._tileInfoView.tileInfo.size);h=await this._fetchImage(l,s)}catch(a){if(t(a))throw a;h=await this._fetchImage(e,s)}return this.resampling?m(this._tileInfoView,h,l,e):h}async _enqueueTileFetch(e){if(!this._fetchQueue.has(e.key.id)){try{const i=await this._fetchQueue.push(e.key);e.bitmap.source=i,e.bitmap.width=this._tileInfoView.tileInfo.size[0],e.bitmap.height=this._tileInfoView.tileInfo.size[1],e.once("attach",(()=>this.requestUpdate()))}catch(r){t(r)||i.getLogger(this.declaredClass).error(r)}this.requestUpdate()}}async _fetchImage(e,i){return this.layer.fetchImageBitmapTile(e.level,e.row,e.col,{signal:i})}};e([s()],v.prototype,"_fetchQueue",void 0),e([s()],v.prototype,"resampling",null),v=e([o("esri.views.2d.layers.TileLayerView2D")],v);const I=v;export{I as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import i from"../../../core/Logger.js";import{isAbortError as t}from"../../../core/promiseUtils.js";import{watch as r}from"../../../core/reactiveUtils.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{equals as l}from"../../../geometry/support/spatialReferenceUtils.js";import{GraphicsCollection as h}from"../../../support/GraphicsCollection.js";import"../../../core/Error.js";import"../../../core/has.js";import"../../../core/scheduling.js";import"../../../request.js";import"../../../chunks/index2.js";import"../../../core/urlUtils.js";import"../../../chunks/index3.js";import"../../../layers/effects/EffectView.js";import"../engine/DisplayObject.js";import"../engine/webgl/effects/highlight/HighlightGradient.js";import"../engine/webgl/BufferPool.js";import"../engine/webgl/enums.js";import"../../webgl/enums.js";import"../../../chunks/vec2f32.js";import"../../../layers/support/rasterFunctions/pixelUtils.js";import"../../webgl/context-util.js";import"../../webgl/Texture.js";import"../engine/imagery/colorizer/rasterColorizer.js";import"../engine/imagery/processor/rasterProcessor.js";import"../../webgl/BufferObject.js";import"../../webgl/VertexArrayObject.js";import"../../webgl/FramebufferObject.js";import"../engine/webgl/brushes/BrushBitmap.js";import"../../../chunks/vec4f32.js";import"../engine/webgl/Utils.js";import"../engine/webgl/shaders/BackgroundPrograms.js";import"../../webgl/checkWebGLError.js";import"../../../chunks/builtins.js";import"../../../core/RandomLCG.js";import"../engine/webgl/materialKey/MaterialKey.js";import"../engine/webgl/techniques/Technique.js";import"../engine/webgl/techniques/dotDensity/TechniqueDotDensity.js";import"../engine/webgl/techniques/heatmap/TechniqueHeatmap.js";import"../engine/webgl/techniques/pieChart/TechniquePieChart.js";import"../engine/webgl/brushes/WGLBrushHeatmap.js";import"../engine/webgl/DefaultVertexAttributeLayouts.js";import"../engine/webgl/shaders/TileInfoPrograms.js";import"../engine/webgl/brushes/WGLGeometryBrushMarker.js";import"../../../core/mathUtils.js";import"../engine/webgl/number.js";import"../engine/vectorTiles/style/StyleDefinition.js";import"../engine/vectorTiles/enums.js";import"../engine/vectorTiles/shaders/sources/resolver.js";import"../engine/webgl/shaders/BitBlitPrograms.js";import"../engine/webgl/shaders/sources/resolver.js";import"../engine/webgl/TextureManager.js";import"../engine/webgl/shaders/StencilPrograms.js";import"../engine/webgl/effects/BlendEffect.js";import"../engine/webgl/shaders/HighlightPrograms.js";import"../engine/webgl/Profiler.js";import"../../webgl/renderState.js";import"../../3d/webgl-engine/core/shaderModules/interfaces.js";import"../../../core/floatRGBA.js";import"../../3d/webgl-engine/lib/OrderIndependentTransparency.js";import"../../../chunks/webgl-debug.js";import"../LabelManager.js";import a from"./graphics/GraphicsView2D.js";import"../engine/webgl/AttributeStoreView.js";import"../../../chunks/earcut.js";import"../../../layers/graphics/featureConversionUtils.js";import"../../../core/unitUtils.js";import"../../../renderers/support/lengthUtils.js";import"../../../chunks/vec3f32.js";import"../../../geometry/support/normalizeUtils.js";import"../navigation/MapViewNavigation.js";import"../../../core/asyncUtils.js";import"../engine/webgl/shaders/MagnifierPrograms.js";import{BitmapTileLayerView2D as n}from"./BitmapTileLayerView2D.js";import{LayerView2DMixin as p}from"./LayerView2D.js";import g from"./graphics/HighlightGraphicContainer.js";import{createBlankImage as c,resampleImage as m}from"./support/imageUtils.js";import u from"../tiling/TileInfoView.js";import f from"../tiling/TileKey.js";import w from"../tiling/TileQueue.js";import j from"../tiling/TileStrategy.js";import d from"../../layers/LayerView.js";import y from"../../layers/RefreshableLayerView.js";import{isMapServiceLayerView as b,MapServiceLayerViewHelper as _}from"../../layers/support/MapServiceLayerViewHelper.js";import{createQueryGeometry as T}from"../../support/drapedUtils.js";const V=[0,0];let v=class extends(y(n(p(d)))){constructor(){super(...arguments),this._fetchQueue=null,this._highlightGraphics=new h,this._popupHighlightHelper=null,this._tileStrategy=null,this.layer=null}get resampling(){return!("resampling"in this.layer)||!1!==this.layer.resampling}update(e){this._fetchQueue.pause(),this._fetchQueue.state=e.state,this._tileStrategy.update(e),this._fetchQueue.resume()}attach(){const e="tileServers"in this.layer?this.layer.tileServers:null;this._tileInfoView=new u(this.layer.tileInfo,this.layer.fullExtent),this._fetchQueue=new w({tileInfoView:this._tileInfoView,concurrency:e&&10*e.length||10,process:(e,i)=>this.fetchTile(e,i)}),this._tileStrategy=new j({cachePolicy:"keep",resampling:this.resampling,acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView}),b(this)&&(this._highlightView=new a({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new g(this.view.featuresTilingScheme)}),this.container.addChild(this._highlightView.container),this._popupHighlightHelper=new _({createFetchPopupFeaturesQueryGeometry:(e,i)=>T(e,i,this.view),highlightGraphics:this._highlightGraphics,highlightGraphicUpdated:(e,i)=>{this._highlightView.graphicUpdateHandler({graphic:e,property:i})},layerView:this,updatingHandles:this.updatingHandles})),this.requestUpdate(),this.handles.add(r((()=>this.resampling),(()=>{this.doRefresh()}))),super.attach()}detach(){super.detach(),this._tileStrategy.destroy(),this._fetchQueue.clear(),this.container.removeAllChildren(),this._popupHighlightHelper?.destroy(),this._fetchQueue=this._tileStrategy=this._tileInfoView=this._popupHighlightHelper=null}async fetchPopupFeatures(e,i){return this._popupHighlightHelper?this._popupHighlightHelper.fetchPopupFeatures(e,i):[]}highlight(e){return this._popupHighlightHelper?this._popupHighlightHelper.highlight(e):{remove(){}}}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return l(this.layer.tileInfo?.spatialReference,e)}async doRefresh(){!this.attached||this.updateRequested||this.suspended||(this._fetchQueue.reset(),this._tileStrategy.tiles.forEach((e=>this._enqueueTileFetch(e))))}isUpdating(){return this._fetchQueue?.updating??!1}acquireTile(e){const i=this._bitmapView.createTile(e),t=i.bitmap;return[t.x,t.y]=this._tileInfoView.getTileCoords(V,i.key),t.resolution=this._tileInfoView.getTileResolution(i.key),[t.width,t.height]=this._tileInfoView.tileInfo.size,this._enqueueTileFetch(i),this._bitmapView.addChild(i),this.requestUpdate(),i}releaseTile(e){this._fetchQueue.abort(e.key.id),this._bitmapView.removeChild(e),e.once("detach",(()=>e.destroy())),this.requestUpdate()}async fetchTile(e,i={}){const r="tilemapCache"in this.layer?this.layer.tilemapCache:null,{signal:s,resamplingLevel:o=0}=i;if(!r)try{return await this._fetchImage(e,s)}catch(a){if(!t(a)&&!this.resampling)return c(this._tileInfoView.tileInfo.size);if(o<3){const t=this._tileInfoView.getTileParentId(e.id);if(t){const r=new f(t),s=await this.fetchTile(r,{...i,resamplingLevel:o+1});return m(this._tileInfoView,s,r,e)}}throw a}const l=new f(0,0,0,0);let h;try{if(await r.fetchAvailabilityUpsample(e.level,e.row,e.col,l,{signal:s}),l.level!==e.level&&!this.resampling)return c(this._tileInfoView.tileInfo.size);h=await this._fetchImage(l,s)}catch(a){if(t(a))throw a;h=await this._fetchImage(e,s)}return this.resampling?m(this._tileInfoView,h,l,e):h}async _enqueueTileFetch(e){if(!this._fetchQueue.has(e.key.id)){try{const i=await this._fetchQueue.push(e.key);e.bitmap.source=i,e.bitmap.width=this._tileInfoView.tileInfo.size[0],e.bitmap.height=this._tileInfoView.tileInfo.size[1],e.once("attach",(()=>this.requestUpdate()))}catch(r){t(r)||i.getLogger(this.declaredClass).error(r)}this.requestUpdate()}}async _fetchImage(e,i){return this.layer.fetchImageBitmapTile(e.level,e.row,e.col,{signal:i})}};e([s()],v.prototype,"_fetchQueue",void 0),e([s()],v.prototype,"resampling",null),v=e([o("esri.views.2d.layers.TileLayerView2D")],v);const I=v;export{I as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{handlesGroup as t,makeHandle as i}from"../../../../../core/handleUtils.js";import{isSome as s,isNone as a,applySome as r,destroyMaybe as n}from"../../../../../core/maybe.js";import{watch as l,initial as o}from"../../../../../core/reactiveUtils.js";import{property as c}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import{subclass as
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{handlesGroup as t,makeHandle as i}from"../../../../../core/handleUtils.js";import{isSome as s,isNone as a,applySome as r,destroyMaybe as n}from"../../../../../core/maybe.js";import{watch as l,initial as o}from"../../../../../core/reactiveUtils.js";import{property as c}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{s as p}from"../../../../../chunks/vec3.js";import{c as u}from"../../../../../chunks/vec3f64.js";import{getEffectiveElevationInfo as m,getEffectiveElevationMode as v}from"../../../../../support/elevationInfoUtils.js";import d from"../../../../../symbols/support/ElevationInfo.js";import{SegmentLabels3D as f}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as V}from"../../SnappingVisualizer3D.js";import{settings as E}from"../settings.js";import{ExtendedLineVisualElement as w}from"../../visualElements/ExtendedLineVisualElement.js";import{OutlineVisualElement as _}from"../../visualElements/OutlineVisualElement.js";import{VerticesVisualElement as y}from"../../visualElements/VerticesVisualElement.js";import{evaluateElevationAlignmentAtPoint as g}from"../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as j}from"../../../layers/graphics/ElevationContext.js";import{GraphicState as I}from"../../../layers/graphics/GraphicState.js";import{RenderOccludedFlag as L}from"../../../webgl-engine/lib/Material.js";import{DrawGraphicTool as S,geometryTypeToDrawOperationGeometryType as G}from"../../../../draw/DrawGraphicTool.js";import{DrawOperation as D}from"../../../../draw/DrawOperation.js";import{SceneDrawSurface as O,ElevationDrawSurface as x}from"../../../../draw/drawSurfaces.js";let T=class extends S{constructor(e){super(e),this._activeVertexVisualElement=null,this._createGraphicState=null,this._outlineVisualElement=null,this._verticesVisualElement=null,this._verticalLineVisualElement=null,this.geometryType=null,this.type="draw-3d"}initialize(){const{mode:e,offset:t}=this.elevationInfo;this.internalGraphicsLayer.elevationInfo=new d({mode:e,offset:t})}normalizeCtorArgs(e){if(!e.elevationInfo){const t=e.hasZ??!0;return{...e,elevationInfo:m(t)}}return e}initializeGraphic(e){const i=this._createGraphicState=new I({graphic:e});return t([this.view.maskOccludee(e),this.view.trackGraphicState(i),l((()=>({element:this._outlineVisualElement,isDraped:i.isDraped})),(({element:e,isDraped:t})=>{r(e,(e=>e.isDraped=t))}),o)])}makeDrawOperation(){const{geometryType:e}=this,t="circle"!==e&&"rectangle"!==e;return new D({view:this.view,manipulators:this.manipulators,geometryType:G(e),drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:new O(this.view,this.elevationInfo,[this.internalGraphicsLayer]),elevationDrawSurface:new x(this.elevationInfo,this.defaultZ,this.view,this.internalGraphicsLayer),hasM:!1,elevationInfo:this.elevationInfo,snappingManager:this.snappingManager,snappingVisualizer:new V,segmentLabels:t?new f:null,labelOptions:this.labelOptions,tooltipOptions:this.tooltipOptions,isDraped:s(this._createGraphicState)?this._createGraphicState.isDraped:"on-the-ground"===v(this.hasZ,this.elevationInfo)})}onActiveVertexChanged(e){const{view:t}=this;return s(this._activeVertexVisualElement)?(this._activeVertexVisualElement.vertices=[e],this._updateVerticalLineVisualElement(e),null):(this._activeVertexVisualElement=new y({view:t,spatialReference:t.spatialReference,vertices:[e],elevationInfo:this.internalGraphicsLayer.elevationInfo,renderOccluded:E.reshapeManipulators.vertex.renderOccluded,attached:!1}),this._activeVertexVisualElement.color=E.colorToVec4(E.reshapeManipulators.selected.color),this._activeVertexVisualElement.attached=!0,this._verticalLineVisualElement=new w({view:t,extensionType:E.visualElements.zVerticalLine.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:L.OccludeAndTransparent}),E.visualElements.zVerticalLine.apply(this._verticalLineVisualElement),i((()=>{this._activeVertexVisualElement=n(this._activeVertexVisualElement),this._verticalLineVisualElement=n(this._verticalLineVisualElement)})))}_updateVerticalLineVisualElement(e){const t=this._verticalLineVisualElement;if(a(t))return;const{renderCoordsHelper:i,elevationProvider:s}=this.view;p(M,e[0],e[1],e[2]),b.setFromElevationInfo(this.elevationInfo),M[2]=g(M,s,b,i);i.toRenderCoords(M,this.view.spatialReference,M)?(t.setStartEndFromWorldDownAtLocation(M),t.attached=!0):t.attached=!1}onOutlineChanged(e){if(s(this._outlineVisualElement))return this._outlineVisualElement.geometry=e,null;const t=this.internalGraphicsLayer.elevationInfo;return this._outlineVisualElement=new _({view:this.view,geometry:e,elevationInfo:t,isDraped:s(this._createGraphicState)?this._createGraphicState.isDraped:"on-the-ground"===v(this.hasZ,t),attached:!1}),E.visualElements.lineGraphics.outline.apply(this._outlineVisualElement),E.visualElements.lineGraphics.shadowStyle.apply(this._outlineVisualElement),this._outlineVisualElement.attached=!0,this._outlineVisualElement.laserlineEnabled=!0,i((()=>{this._outlineVisualElement=n(this._outlineVisualElement)}))}onRegularVerticesChanged(e){return s(this._verticesVisualElement)?(this._verticesVisualElement.vertices=e,null):(this._verticesVisualElement=new y({view:this.view,spatialReference:this.view.spatialReference,vertices:e,elevationInfo:this.internalGraphicsLayer.elevationInfo,renderOccluded:E.reshapeManipulators.vertex.renderOccluded,attached:!1}),this._verticesVisualElement.attached=!0,i((()=>{this._verticesVisualElement=n(this._verticesVisualElement)})))}};e([c({constructOnly:!0})],T.prototype,"elevationInfo",void 0),e([c({constructOnly:!0})],T.prototype,"geometryType",void 0),e([c()],T.prototype,"type",void 0),e([c({constructOnly:!0})],T.prototype,"view",void 0),T=e([h("esri.views.3d.interactive.editingTools.draw.DrawGraphicTool3D")],T);const b=new j,M=u();export{T as DrawGraphicTool3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{removeUnordered as s}from"../../../core/arrayUtils.js";import{ByteSizeUnit as r}from"../../../core/byteSizeEstimations.js";import o from"../../../core/Collection.js";import has from"../../../core/has.js";import a from"../../../core/Logger.js";import{someMap as n}from"../../../core/MapUtils.js";import{unwrapOr as l,destroyMaybe as d,isSome as h,isNone as c,applySome as u}from"../../../core/maybe.js";import _ from"../../../core/PooledArray.js";import{isAbortError as m,throwIfAborted as g,createResolver as p}from"../../../core/promiseUtils.js";import{initial as f,watch as b}from"../../../core/reactiveUtils.js";import{schedule as y}from"../../../core/scheduling.js";import{isArrayBuffer as v}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as I}from"../../../core/unitUtils.js";import{property as M}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as C}from"../../../core/accessorSupport/decorators/subclass.js";import{f as x}from"../../../chunks/mat3.js";import{c as O}from"../../../chunks/mat3f32.js";import{m as E,D as S}from"../../../chunks/mat4.js";import{b as j,c as w}from"../../../chunks/mat4f64.js";import{f as T}from"../../../chunks/quatf64.js";import{m as A,s as D,t as R,a as N,c as P,g as F,b as V}from"../../../chunks/vec3.js";import{c as U}from"../../../chunks/vec3f64.js";import{s as H}from"../../../chunks/vec4.js";import{f as G}from"../../../chunks/vec4f64.js";import{projectBuffer as L,getProjectorName as k,localLinearScaleFactors as B,projectVectorToVector as q,projectBoundingSphere as z}from"../../../geometry/projection.js";import{create as K,empty as W,expandWithBuffer as $,toRect as X}from"../../../geometry/support/aaBoundingBox.js";import{create as Y,intersects as Q}from"../../../geometry/support/aaBoundingRect.js";import{fallbackObjectIDAttribute as J}from"../../../layers/LayerConstants.js";import Z from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as ee}from"../../../layers/support/fieldUtils.js";import te from"../../../layers/support/SceneModification.js";import{getColor as ie,getOpacity as se}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as re}from"../../../support/arcadeOnDemand.js";import oe from"../../../symbols/Symbol3D.js";import{getMetersPerUnit as ae}from"../../../symbols/support/unitConversionUtils.js";import ne from"./I3SMeshViewLabeler.js";import{I3SMeshWorkerHandle as le,toWasmModification as de}from"./I3SMeshWorkerHandle.js";import{ForAllFeaturesVisibilityMode as he,ForAllFeaturesReturnType as ce}from"./II3SMeshView3D.js";import{initialize as ue,setModificationsSync as _e,filterObbsForModificationsSync as me,interpretObbModificationResults as ge}from"./SceneLayerWorker.js";import{overrideColor as pe}from"./graphics/graphicUtils.js";import{areLabelsVisible as fe}from"./graphics/Labeler.js";import{TextureUsage as be,TextureEncoding as ye}from"./i3s/enums.js";import ve from"./i3s/Highlights.js";import{I3SAsyncElevationUpdater as Ie}from"./i3s/I3SAsyncElevationUpdater.js";import{I3SCrossfadeHelper as Me,NodeCrossfadeMetaData as Ce}from"./i3s/I3SCrossfadeHelper.js";import xe from"./i3s/I3SElevationProvider.js";import{boundingBoxCornerPoints as Oe}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Ee}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as Se,selectEncoding as je,defaultMaterial as we,createTexture as Te,configureMaterial as Ae}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as De,NodeState as Re}from"./i3s/I3SNode.js";import{I3SOverrides as Ne}from"./i3s/I3SOverrides.js";import{computeGlobalTransformation as Pe,getLocalOrigin as Fe}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ve,checkSceneLayerValid as Ue,checkSceneLayerCompatibleWithView as He,getCacheKeySuffix as Ge,whenGraphicAttributes as Le,computeVisibilityObb as ke,filterInPlace as Be,getCachedAttributeValue as qe,intersectBoundingRectWithMbs as ze,MbsIntersectResult as Ke,addWraparound as We,getSymbolInfo as $e,transparentEdgeMaterial as Xe,getClipRect as Ye}from"./i3s/I3SUtil.js";import{IDBCache as Qe}from"./i3s/IDBCache.js";import{IDBMockCache as Je}from"./i3s/IDBMockCache.js";import{attributeLookup as Ze}from"./support/attributeUtils.js";import{ColorMixModeEnum as et}from"./support/symbolColorUtils.js";import tt from"../support/debugFlags.js";import{toBoundingRect as it}from"../support/extentUtils.js";import{create as st,clone as rt}from"../support/orientedBoundingBox.js";import{updatingProgress as ot}from"../support/updatingProperties.js";import{glLayout as at}from"../support/buffer/glUtil.js";import{State as nt}from"../webgl-engine/collections/Component/ComponentObject.js";import{createVertexBufferLayout as lt}from"../webgl-engine/collections/Component/SourceGeometry.js";import{TextureCoordinateAttributeType as dt}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasis as ht}from"../webgl-engine/lib/BasisUtil.js";import{newDoubleArray as ct}from"../webgl-engine/lib/DoubleArray.js";import{Transparency as ut}from"../webgl-engine/lib/edgeRendering/interfaces.js";const _t="esri.views.3d.layers.I3SMeshView3D",mt=a.getLogger(_t),gt=[1,1,1,1];class pt extends Ce{constructor(e,t,i,s,r,o,a){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.cachedMidsTerrainSR=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbology=null}}var ft;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(ft||(ft={}));const bt=19,yt=100*r.MEGABYTES,vt=t=>{let r=class extends t{constructor(...e){super(e),this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._currentRenderer=null,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._visibleGeometryChangedSchedulerHandle=null,this._idbCache=has("enable-feature:idb-mock-cache")?new Je:new Qe("esri-scenelayer-cache","geometries"),this._hasComponentData=!1,this._hasVertexColors=!1,this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._elevationTask=null,this._filters=[],this._arcade=null,this._tmpAttributeOnlyGraphic=new i(null,null,{}),this._crossfadeHelper=new Me(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get layerId(){return this.i3slayer&&this.i3slayer.id}get sublayerId(){return null}get updatingProgressValue(){return this._controller?.updatingProgress??0}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return Ve(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?be.AllTexturesPBR:be.AllTextures:this._usePBR||this._hasLoadedPBRTextures?be.GeometryTexturesPBR:be.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=I(this.i3slayer.spatialReference),i=ae(e.unit);return l(e.offset,0)*i/t}return 0}get elevationInfo(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null==e)return{mode:Ut.Absolute,offset:0};const t=I(this.i3slayer.spatialReference),i=ae(e.unit),s=l(e.offset,0)*i/t;switch(e.mode){case"absolute-height":return{mode:Ut.Absolute,offset:s};case"relative-to-ground":return{mode:Ut.RelativeToGround,offset:s};case"on-the-ground":return{mode:Ut.OnTheGround,offset:0};default:return{mode:Ut.Absolute,offset:0}}}get supportedTextureEncodings(){return Se(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){const e=this.view?.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,t=0==(this.supportedTextureEncodings&ye.DDS_S3TC);return e&&t}initialize(){this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController;this.i3sOverrides=new Ne({view:this.view,layer:this.i3slayer,memoryController:e.memoryController}),this._worker=new le((t=>e.immediate.schedule(t))),this.addResolvingPromise(this._worker.promise);const t=this.i3slayer.store;this._worker.setLegacySchema(this.layerUid,t.defaultGeometrySchema),Ue(this.i3slayer),He(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new Z({layerView:this}),this._gpuMemoryEstimate=0,this._texMemoryEstimate=0,this._geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this._highlights=new ve({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,he.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)});const i=t.defaultGeometrySchema;if(this._isIntegratedMesh||!i)this._hasComponentData=!1;else{const e=i.featureAttributes;this._hasComponentData=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=(i?.vertexAttributes.color??null)&&(null==this.i3slayer.cachedDrawingInfo||!this.i3slayer.cachedDrawingInfo.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderer.ensureEdgeView());const s=this.view.resourceController.memoryController.newCache(this.i3slayer.uid,(e=>this._deleteComponentObject(e)));this._memCache=s;const r=e=>h(this._controller.index)&&h(this._controller.index.rootNode)?this._controller.index.traverse(this._controller.index.rootNode,(t=>{const i=t.index,s=this._nodeId2Meta.get(i)||this._nodeId2MetaReloading.get(i);return e(t,h(s)?s.objectHandle:null)})):()=>{};this._intersectionHandler=new Ee({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:r}),this._elevationProvider=new xe({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this.updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),f),this.updatingHandles.add((()=>this.fullOpacity),(e=>this._opacityChange(e))),this.updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this.updatingHandles.add((()=>this.elevationOffset),((e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()})),this.updatingHandles.add((()=>this.elevationInfo),((e,t)=>this._elevationInfoChanged(e,t)),f),this.updatingHandles.add((()=>!this.suspended&&this.elevationInfo.mode!==Ut.Absolute),((e,t)=>{e?this.handles.add(this.view.basemapTerrain.on("elevation-change",(({extent:e})=>this._ensureElevationTask().addExtent(e))),Lt):t&&this.handles.remove(Lt)}),f),this.updatingHandles.add((()=>this._usePBR),(e=>this._updatePBR(e)));const o=()=>{this._reloadAll(),this.clearMemCache()};this.updatingHandles.add((()=>this.rendererTextureUsage),o),this.updatingHandles.add((()=>this.uncompressedTextureDownsamplingEnabled),o),this.updatingHandles.add((()=>this.suspended),(e=>this._suspendedChange(e)),f),this.updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),f),this.handles.add([b((()=>tt.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&tt.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||tt.I3S_TREE_SHOW_TILES||(this._treeDebugger=d(this._treeDebugger))}),f),b((()=>tt.I3S_SHOW_MODIFICATIONS),(()=>this._showModifications()),f)]),this._cacheKeySuffix=Ge(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch((e=>mt.warn(`Failed to initialize IndexedDB cache: ${e}`)))}destroy(){this._clearAddTasks(),this._elevationTask=d(this._elevationTask),this.i3sOverrides=d(this.i3sOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.i3slayer.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=d(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=d(this._labeler),this._treeDebugger=d(this._treeDebugger),this._controller=d(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_memEstimateTextureAdded(e){const t=e.estimatedTexMemRequired;return this._gpuMemoryEstimate+=t,this._texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(h(e)){const t=e.estimatedTexMemRequired;this._gpuMemoryEstimate-=t,this._texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this._gpuMemoryEstimate+=t,this._geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this._gpuMemoryEstimate-=t,this._geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}getUsedMemory(){let e=h(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=h(t)?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=h(t)?t.node.memory:0)),e}getUnloadedMemory(){return(h(this._controller)?this._controller.unloadedMemoryEstimate:0)+(h(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!(fe(this.i3slayer)&&this._supportsLabeling))return void(h(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(h(this._labeler))return;const e=new ne({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach((t=>h(t)&&this._addMetaToLabeler(e,t))),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then((e=>(--this._asyncModuleLoading,e)),(e=>{throw--this._asyncModuleLoading,e}))}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=ue().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.i3slayer.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=de(this._layerClippingArea,this._modifications,t);_e({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new _:null;this._nodeId2Meta.forEach(((e,t)=>{c(e)?(this._nodeId2Meta.delete(t),this._controller.updateLoadStatus(t,!1)):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):h(s)&&s.push(e.node)})),h(s)&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),h(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==De.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),h(t)?(this._nodeId2Meta.delete(e.index),this._nodeId2MetaReloading.set(e.index,t)):this._nodeId2Meta.has(e.index)&&(this._nodeId2Meta.delete(e.index),this._controller.updateLoadStatus(e.index,!1))}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(h(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!tt.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){const r=s.geometry;r.spatialReference=this.i3slayer.spatialReference;const o={...t,color:e[s.type]};this._modificationGraphics.push(new i({geometry:r,symbol:o}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_suspendedChange(e){e?(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler)):(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);h(i)&&h(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);h(s)&&(await this.i3sOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._controller.reschedule((()=>this._attributeValuesChanged(s)),i).catch((e=>{m(e)||mt.warn("Error while updating attribute values. Layer might not display correctly.",e)})))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,h(this._labeler)&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){h(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>h(t)&&e.push(t.node))),e}getNodeComponentObb(e){const t=this._nodeId2Meta.get(e.index)??this._nodeId2MetaReloading.get(e.index);return h(t)?this._collection.getComponentObb(t.objectHandle):null}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!has("disable-feature:i3s-basis")&&0!=(this.supportedTextureEncodings&ye.Basis)&&u(this.i3slayer.textureSetDefinitions,(e=>e.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))))&&ht()}_getVertexBufferLayout(e,t){const i={hasTexture:Tt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return at(lt(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||J}_findGraphicNodeAndIndex(e){const t=Ze(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return n(this._nodeId2Meta,(e=>{if(c(e))return!1;const s=e.featureIds.indexOf(t);return-1!==s&&(i={node:e.node,index:s},!0)})),i}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(c(i))return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=Ze(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._getAABB(t.node.index,t.index);return c(i)?Promise.reject():Promise.resolve({boundingBox:i,screenSpaceObjects:[]})}getAABBFromIntersectorTarget(e){return null==e.nodeIndex||null==e.componentIndex?null:this._getAABB(e.nodeIndex,e.componentIndex)}_getAABB(e,t){const i=this._nodeId2Meta.get(e);if(c(i)||null==i.featureIds||t>=i.featureIds.length)return null;const s=i.objectHandle,r=Oe(t,this._collection,s,ct(24)),o=this.view.renderSpatialReference,a=this.view.spatialReference;if(!L(r,o,0,r,a,0,8))return null;const n=W();return $(n,r,0,8),n}whenGraphicAttributes(e,t){return Le(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(h)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return c(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${bt}/${e.id}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return h(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){h(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(c(this._memCache))return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,e.node.memory,i)}loadMissingTextures(e,t,i,s){const r=e?.filter(((e,i)=>{if(0==(e.usage&this.rendererTextureUsage))return!1;if(c(t))return!0;const s=je(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(c(r)||null==r.data||s&&r.encoding!==s.encoding)}))??[];return 0===r.length?Promise.resolve(!1):i(r,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e)),null):(this.elevationInfo.mode===Ut.Absolute&&(e.geometryObb=s.geometryObb),this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&h(s.textureData)&&(s.byteSize=Rt(s.transformedGeometry,s.textureData),s.textureData.every(Dt)&&Nt(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch((t=>mt.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),g(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return At(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(c(s))return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,transformedGeometry:n}=s,l=this._controller.crsIndex,d=this.view.renderSpatialReference,u=Pe(e.mbs,this.elevationOffset,l,d),_=st([r.center.x,r.center.y,r.center.z],[r.extents.x,r.extents.y,r.extents.z],T(r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w));A(_.center,_.center,u),this.elevationInfo.mode===Ut.Absolute&&(e.geometryObb=_),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.from(a));const m={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:n,globalTrafo:u,geometryObb:_,byteSize:Rt(n,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&Nt(e,m)){const t=h(m.textureData)?m.textureData.map((e=>Dt(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e),{...m,textureData:t}).catch((t=>mt.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,m,i)}),i))))):Promise.reject()}computeVisibilityObb(e){return ke(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications)}_transformNode(e,t,i){const s=t.geometryData.geometries??[],r=new Array(s.length);for(let c=0;c<s.length;++c)r[c]=this._getVertexBufferLayout(s[c],t.geometryDescriptor);const o=e.mbs,a=this.elevationOffset,n=this._controller.crsIndex,l=this._controller.crsVertex,d=this.view.renderSpatialReference,h=Fe(o,a,n),u=Pe(o,a,n,d),_=k(n,l),m=k(l,d);if(c(_)||c(m))return Promise.resolve(null);const g={context:this.i3slayer.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,localOrigin:h,globalTrafo:u,mbs:o,obb:e.serviceObb,elevationOffset:a,needNormals:!this._isIntegratedMesh&&this._controller.isMeshPyramid,normalReferenceFrame:this.i3slayer.normalReferenceFrame||"none",indexToVertexProjector:_,vertexToRenderProjector:m};return this._worker.invoke(g,i)}get _supportsNodeCrossFading(){return!this.view?._stage?.renderer.shadowsEnabled}get nodeCrossfadingEnabled(){return this._supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this._supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(this.elevationInfo.mode===Ut.Absolute&&(e.geometryObb=rt(this._collection.getComponentObb(t.objectHandle))),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);h(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,nt.Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this.elevationInfo.mode!==Ut.Absolute&&this._ensureElevationTask().schedule(s),this._updateEngineObject(t),this._highlights.objectCreated(t),h(this._treeDebugger)&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async _addCachedNodeData(e,t,i){if(this.suspended||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(c(t))return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:o,globalTrafo:a}=t;await this.i3sOverrides.apply(r.featureIds,s.attributeInfo,i);const n=h(t.textureData)?t.textureData.filter((e=>h(e)&&0!=(e.usage&this.rendererTextureUsage))):[];!has("disable-feature:i3s-basis")&&n.some((e=>h(e)&&(e.encoding===ye.Basis||e.encoding===ye.KTX2)))&&await ht(),e.memory=0;const{componentOffsets:l,geometries:d,featureIds:u}=r,_=this._collection,m=d[0],{layout:g,indices:p,interleavedVertexData:f,positionData:b,hasColors:y}=o,v=this._materialParameters(m,g),I=l||new Uint32Array([0,p?p.length:f.byteLength/g[0].stride]),M={vertices:{data:f,count:f.byteLength/g[0].stride,layoutParameters:v.geometryParams},positionData:{positions:b.data,indices:b.indices},indices:p,componentOffsets:I},C=m.transformation?j(m.transformation):w();E(C,a,C);const T=S(U(),C),A=x(O(),C),D=this.view.renderSpatialReference,R=this.view.basemapTerrain.spatialReference,N=U(),P=[1,1,1];B(T,D,P,R)||mt.errorOnce("Unsupported coordinate system for IM overlay"),q(T,D,N,R);const F=_.createObject({toMapSpace:G(N[0],N[1],P[0],P[1]),geometry:M,obb:t.geometryObb,transform:{position:T,rotationScale:A}}),V=v.geometryParams.textureCoordinates===dt.Atlas,{textures:H,texturePromise:L}=this._initMaterialAndTextures(F,v.material,n,V);e.memory+=this._memEstimateGeometryAdded(F),e.memory+=H.reduce(((e,t)=>e+(h(t)?this._memEstimateTextureAdded(t):0)),0);const k=!!v.material.hasParametersFromSource,z="blend"!==v.material.alphaMode&&v.material.metallicRoughness.baseColorFactor[3]>=1,K=new pt(e,u,F,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:k,isOpaque:z},H);s.meta=K,!this._hasTextures&&t.requiredTextures?.some((({usage:e})=>0!=(e&be.ColorTextures)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||y,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const W=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(K),L]).then((([t,s])=>(h(t)&&t.updateObjectVisibility(K.objectHandle,!1).catch((e=>It(e,this.i3slayer.title))),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(this._addNodeMeta(e.index,K),i.meta=null,this.suspended)return void this._removeNodeStageData(e.index,this.elevationOffset);_.setObjectVisibility(F,nt.Visible),h(t)&&t.updateObjectVisibility(K.objectHandle,!0).catch((e=>It(e,this.i3slayer.title))),K.attributeInfo=i.attributeInfo;const s=K.cachedRendererVersion!==this._rendererVersion,r=W!==this.slicePlaneEnabled;this._updateElevationOffsets(K);const o=K.elevationOffsets;this._updateComponentData(K);const a=this._applyFiltersToNode(K);(s||h(t)&&(r||a||o))&&this._addOrUpdateEdgeRendering(K),h(this._labeler)&&this._addMetaToLabeler(this._labeler,K),this._visibleGeometryChanged(K,Mt.ADD),this._highlights.objectCreated(K),this._updateMaterial(K),this._setNewNodeOpacity(K),h(this._treeDebugger)&&this._treeDebugger.update()}),i)))).catch((e=>{throw h(s.meta)&&(this._cacheGPUData(s.meta),s.meta=null),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){mt.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);h(t)&&this._deleteComponentObject(t)}else this._controller.updateLoadStatus(e,!0);h(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Vt(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_updateElevationOffsets(e){const t=this.view.renderSpatialReference,i=this.elevationInfo,s=this.view.basemapTerrain,r=s.spatialReference,o=i.mode;if(c(t)||c(r)||o===Ut.Absolute)return void(e.elevationOffsets=null);const a=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const n=Ht,l=Gt,d=o===Ut.OnTheGround,u=this.view.renderCoordsHelper,_=!!e.cachedMidsTerrainSR,m=e.featureIds.length;if(!_){e.cachedMidsTerrainSR=ct(3*m);const i=e.cachedMidsTerrainSR;for(let s=0;s<m;s++){this._collection.getComponentAabb(e.objectHandle,s,l,!0),D(n,(l[0]+l[3])/2,(l[1]+l[4])/2,l[2]),R(n,n,a.rotationScale),N(n,n,a.position);const o=3*s;i[o+2]=u.getAltitude(n),q(n,t,n,r),i[o+0]=n[0],i[o+1]=n[1]}}const g=e.cachedMidsTerrainSR,p=i.offset,f=e.elevationOffsets,b=(e,t)=>{const i=d?g[3*e+2]:0;f[e]=p+(h(t)?t-i:0)};s.getElevations(g,m,b)}_ensureElevationTask(){return h(this._elevationTask)||(this._elevationTask=new Ie(this.view.resourceController.scheduler,(e=>{const t=this._controller.updateElevationChanged(e,this.view.basemapTerrain.spatialReference);return h(t)?t.filterInPlace((e=>h(this._nodeId2Meta.get(e)))):null}),(e=>{const t=this._nodeId2Meta.get(e);this._nodeElevationAlignmentChanged(t)}))),this._elevationTask}_elevationInfoChanged(e,t){const i=e.mode!==Ut.Absolute,s=!!t&&t!==e&&t.mode!==Ut.Absolute;this._intersectionHandler.updateElevationAlignState(i,this.view.state.viewingMode),i&&!s&&this._controller.removeAllGeometryObbs(),this._nodeId2Meta.forEach((e=>this._nodeElevationAlignmentChanged(e)))}_nodeElevationAlignmentChanged(e){c(e)||(this._updateElevationOffsets(e),this._updateComponentData(e),this._updateEdgeRendering(e),h(this._labeler)&&this._labeler.updateLabelPositions(e),this._updateSnappingSources(e,Mt.UPDATE))}_safeReschedule(e,t){return g(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=h(e.params.material)?e.params.material:we(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=Tt(i);return{geometryParams:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>Te(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=Ae(e,t,o,i,this.view._stage.renderView.textureRepository,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?dt.Atlas:dt.Default:dt.None,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,i){let s=this._addTasks.get(e.index);return s?s.attributeInfo=t:(s={...p(),attributeInfo:t,meta:null},this._addTasks.set(e.index,s),i().then(s.resolve,s.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))),s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{h(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=Y();this._renderClippingArea=it(this.view.clippingArea,i,e)?i:null;const s=Y();this._layerClippingArea=it(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}get hasGeometryFilter(){return!1}_geometryFilterChange(){const e=this.hasGeometryFilter;this._controller.geometryFilterChanged(e),this._applyFilters(e)}_filterChange(){this._applyFilters(this.hasGeometryFilter)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{h(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,Mt.UPDATE))}))}getFilters(){const e=[],t=this._renderClippingArea;return h(t)&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(h(t)){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,d=h(t.attributeInfo)&&t.attributeInfo.attributeData;s.every((e=>e===n||d&&null!=d[e]))&&Be(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=d?qe(d[i],e):null);try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return z(e.node.mbs,this._controller.crsIndex,wt,this.view.renderSpatialReference),ze(t,wt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,Ct),X(Ct,xt),Q(i,xt)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===Ke.INSIDE)return;if(r===Ke.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(Ot,i,t.objectHandle);Be(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}_addOrUpdateEdgeRendering(e,t=!0){const i=this._edgeView;if(c(i))return Promise.resolve(null);const s=e.objectHandle,r=i.hasObject(s),{hasEdges:o,perFeatureEdgeMaterials:a}=this._getFilteredEdgeMaterials(e),n={hasSlicePlane:this.slicePlaneEnabled};if(o&&r){if(this.nodeCrossfadingEnabled){Vt(a,this.getNodeOpacity(e))}return i.updateAllComponentMaterials(s,a,n,t).catch((e=>It(e,this.i3slayer.title))),i.updateObjectVisibility(s,!0).catch((e=>It(e,this.i3slayer.title))),i.updateAllVerticalOffsets(s,e.elevationOffsets).catch((e=>It(e,this.i3slayer.title))),Promise.resolve(i)}return o&&!r?this._collection.addEdges(s,i,a,n).then((t=>(e.edgeMemoryUsage=t,e.node.memory+=t,i.updateAllVerticalOffsets(s,e.elevationOffsets).catch((e=>It(e,this.i3slayer.title))),i))):(!o&&r&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,i.removeObject(s)),Promise.resolve(null))}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(h(this._labeler)&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=0===t.getComponentCount(e.objectHandle).invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!i;if(this._updateCachedFilteredIds(e),e.filteredIds===e.featureIds)return!i;const s=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,s),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array,i=e.filteredIds;return h(i)&&e.featureIds.forEach(((e,s)=>{i[t.length]===e&&t.push(s)})),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach(((t,i)=>this._removeNodeStageData(i,e))),this._nodeId2MetaReloading.forEach(((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading))),this._elevationTask=d(this._elevationTask)}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading),h(this._elevationTask)&&this._elevationTask.remove(e)}_removeNodeStageData(e,t,i=this._nodeId2Meta){i.has(e)&&this._controller.updateLoadStatus(e,!1);const s=i.get(e);c(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,nt.Hidden),h(this._edgeView)&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1).catch((e=>It(e,this.i3slayer.title))),this._visibleGeometryChanged(s,Mt.REMOVE),h(this._labeler)&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),h(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(h(this._edgeView)&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);h(i)&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===Re.Hole))}_invalidateAllSymbols(){this._rendererVersion=We(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return We(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=We(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await re()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:mt.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&mt.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getComponentParameters(e){this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(i,s)=>{const r=5*i;if(H(s.externalColor,t[r+0]/255,t[r+1]/255,t[r+2]/255,t[r+3]/255),h(this._stage.renderView.objectAndLayerIdRenderHelper)){const t=e.featureIds[i];this._stage.renderView.objectAndLayerIdRenderHelper.setUidToObjectAndLayerId(t,t,this.layerId,this.layerUid,this.layerPopupEnabled,e.node.resources.attributes,i,this.sublayerId),s.objectAndLayerIdColor=this._stage.renderView.getObjectAndLayerIdColor({graphicUid:t,layerUid:this.layerUid})}s.externalColorMixMode=t[r+4]&(1<<ft.CastShadows)-1,s.castShadows=0!=(t[r+4]&1<<ft.CastShadows),s.pickable=0!=(t[r+4]&1<<ft.Pickable),s.elevationOffset=e.elevationOffsets?.[i]??0}}_getSymbolInfo(e,t){const i=e&&e.getSymbol(t,{arcade:this._arcade});if(!(i instanceof oe))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=$e(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=h(this._symbologyOverrideFields)&&this._symbologyOverrideFields.length>0?h(this._rendererFields)&&this._rendererFields.length>0?ee(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasComponentData)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=h(e.attributeInfo)&&e.attributeInfo.attributeData,o=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&h(this._symbologyFields)&&this._symbologyFields.length>0;let n=null,l=null;if(a&&h(this._symbologyFields)){n=[],l=[];for(const e of this._symbologyFields){const t=r[e];t&&(n.push(e),l.push(t))}}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const d={color:St,castShadows:!0,pickable:!0,colorMixMode:et.Multiply,edgeMaterial:null},u=this.fullOpacity,_=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):u;let m=null,g=ut.OPAQUE,p=Xe,f=0;for(let b=0;b<e.featureIds.length;b++){if(null!=o&&(i[o]=e.featureIds[b]),a&&n)for(let e=0;e<n.length;e++)i[n[e]]=qe(l[e],b);const r=s?this._getSymbolInfo(s,t):null;let u=null,y=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=ie(this._colorVariable,t,{color:jt,arcade:this._arcade});e&&(u=St,u[0]=e.r/255,u[1]=e.g/255,u[2]=e.b/255,this._opacityVariable||null===e.a||(y=e.a))}this._opacityVariable&&(y=se(this._opacityVariable,t,{arcade:this._arcade}))}if(r&&r.material){const e=r.material;u=c(u)||c(y)?pe(u,y,e.color,e.alpha,gt,St):pe(u,y,null,null,gt,St)}if(c(u)&&(u=St,u[0]=1,u[1]=1,u[2]=1,u[3]=1),d.pickable=!0,d.castShadows=!r||r.castShadows,d.colorMixMode=r&&r.material?r.material.colorMixMode:et.Multiply,d.edgeMaterial=r?r.edgeMaterial:null,h(this._symbologyOverride)&&(d.color=u,this._symbologyOverride(t,d),u=d.color),h(d.edgeMaterial)){const t=u[3]<=0?ut.INVISIBLE:u[3]>=1&&(e.material.isOpaque||d.colorMixMode===et.Replace)?ut.OPAQUE:ut.TRANSPARENT;d.edgeMaterial===m&&t===g||(p={...d.edgeMaterial,opacity:_,objectTransparency:t},m=d.edgeMaterial,g=t),e.cachedEdgeMaterials[b]=p}else e.cachedEdgeMaterials[b]=Xe;e.cachedSymbology[f+0]=Math.round(255*u[0]),e.cachedSymbology[f+1]=Math.round(255*u[1]),e.cachedSymbology[f+2]=Math.round(255*u[2]),e.cachedSymbology[f+3]=Math.round(255*u[3]),e.cachedSymbology[f+4]=d.colorMixMode|+d.castShadows<<ft.CastShadows|+d.pickable<<ft.Pickable,f+=5}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);this.nodeCrossfadingEnabled||Vt(t,this.fullOpacity);const i=e.filteredIds;if(c(i)){return{hasEdges:t.some((e=>e!==Xe)),perFeatureEdgeMaterials:t}}let s=0,r=!1;const o=t.map(((t,o)=>e.featureIds[o]!==i[s]?Xe:(r=r||t!==Xe,s++,t)));return{hasEdges:r,perFeatureEdgeMaterials:o}}_updateComponentData(e){if(!this._hasComponentData)return;const t=e.objectHandle,i=this._getComponentParameters(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Vt(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.usePBR=this._usePBR,this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._updateComponentData(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,Mt.UPDATE)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),h(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.commonMaterialParameters.hasSlicePlane=e)),this._updateEdgeRendering(t,!1))}))}_updatePBR(e){this._nodeId2Meta.forEach((t=>{c(t)||this._collection.updateMaterial(t.objectHandle,(t=>t.usePBR=e))})),this._hasLoadedPBRTextures=!0}get _usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){h(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=he.VISIBLE_ONLY){n(this._nodeId2Meta,(s=>{if(c(s))return!1;if(h(t)){switch(t(s)){case ce.EXIT:return!0;case ce.SKIP:return!1}}let r=ce.CONTINUE;switch(i){case he.ALL:r=this._forAllFeaturesOfNode(s,e);break;case he.VISIBLE_ONLY:r=this._forVisibleFeaturesOfNode(s,e);break;case he.ALL_IN_CLIPPING_AREA:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return r===ce.EXIT}))}_forAllFeaturesOfNode(e,t){let i=ce.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===ce.EXIT)return i;return i}_forVisibleFeaturesOfNode(e,t){let i=ce.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===ce.CONTINUE))),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(c(this._renderClippingArea))return this._forAllFeaturesOfNode(e,t);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===Ke.OUTSIDE)return ce.CONTINUE;if(i===Ke.INSIDE)return this._forAllFeaturesOfNode(e,t);const s=ce.CONTINUE,r=e.featureIds,o=e.objectHandle,a=Ye(this._renderClippingArea,this._collection.getObjectTransform(o));for(let n=0;n<r.length;n++){if(!this._boundingRectFeatureTest(e,n,a))continue;const i=t(r[n],n,e);if(i===ce.EXIT)return i}return s}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=h(t.attributeInfo)&&t.attributeInfo.attributeData;if(h(s))for(const r of Object.keys(s))i[r]=qe(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e){const t=this._highlights;if("number"==typeof e||e instanceof i?e=[e]:e instanceof o&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof i){const i=e,s=this.i3slayer.fieldsIndex,r=this._getObjectIdField(),o=i.map((e=>Ze(s,e.attributes,r))),{set:a,handle:n}=t.acquireSet();return t.setFeatureIds(a,o),n}if("number"==typeof e[0]){const i=e,{set:s,handle:r}=t.acquireSet();return t.setFeatureIds(s,i),r}}return Ft}_visibleGeometryChanged(e,t){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=y((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))),this._updateSnappingSources(e,t))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this._gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this._geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this._texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.getUnloadedMemory()/1048576).toFixed(1)+"MB"};return h(this._memCache)&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this;return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const t=[];return e._forAllFeatures((e=>(t.push(e),ce.CONTINUE)),null,he.VISIBLE_ONLY),t.sort(((e,t)=>e-t)),t},get numNodes(){return e._nodeId2Meta.size},get loadedNodes(){return Array.from(e._nodeId2Meta.keys()).sort(((e,t)=>e-t))}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return h(e)?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(((t,i)=>e(i,t)))}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);h(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);h(i)&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(c(this._edgeView)||!e.cachedEdgeMaterials)return;Vt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t).catch((e=>It(e,this.i3slayer.title)))}get hasModifications(){return this._isIntegratedMesh&&h(this._layerClippingArea)||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.i3slayer.uid,s=Pt(e);if(h(s)){const t={context:i,buffer:s.buffer};me(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=ge(i);e.imModificationImpact=s,s!==De.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||h(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0||h(this._elevationTask)&&this._elevationTask.running}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(c(s))throw new Error("invalid-node");const{origin:r,buffer:o}=await this._collection.extractEdgeInformation(s.objectHandle,t,i);return this._snappingLocationsApplyElevation(s,o,r),{type:"components",objectIds:s.featureIds,locations:o,origin:r}},remove:()=>{s(this._snappingSourcesTrackers,t)}};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach(((t,i)=>{if(c(t))return;const s=this._controller.getRenderMbs(t.node);h(s)&&e.add(i,s)})),t}_snappingLocationsApplyElevation(e,t,i){if(!e.elevationOffsets||this.elevationInfo.mode===Ut.Absolute)return;const s=t.position0,r=t.position1,o=t.componentIndex,a=U(),n=U(),l=(e,t)=>{N(e,e,i),this.view.renderCoordsHelper.worldUpAtPosition(e,n),N(e,e,F(n,n,t)),V(e,e,i)};for(let d=0;d<s.count;d++){const t=e.elevationOffsets[o.get(d)];s.getVec(d,a),l(a,t),s.setVec(d,a),r.getVec(d,a),l(a,t),r.setVec(d,a)}}_updateSnappingSources(e,t){const{index:i}=e.node,s=this._controller.getRenderMbs(e.node);if(!c(s))for(const r of this._snappingSourcesTrackers)t!==Mt.REMOVE&&t!==Mt.UPDATE||r.events.remove(i),t!==Mt.ADD&&t!==Mt.UPDATE||r.events.add(i,s)}};return e([M()],r.prototype,"_hasLoadedPBRTextures",void 0),e([M()],r.prototype,"_asyncModuleLoading",void 0),e([M()],r.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([M()],r.prototype,"view",void 0),e([M()],r.prototype,"i3slayer",void 0),e([M()],r.prototype,"_controller",void 0),e([M()],r.prototype,"_labeler",void 0),e([M()],r.prototype,"updating",void 0),e([M()],r.prototype,"suspended",void 0),e([M()],r.prototype,"holeFilling",void 0),e([M(ot)],r.prototype,"updatingProgress",void 0),e([M()],r.prototype,"updatingProgressValue",null),e([M()],r.prototype,"hasTexturesOrVertexColors",null),e([M()],r.prototype,"rendererTextureUsage",null),e([M()],r.prototype,"elevationOffset",null),e([M()],r.prototype,"elevationInfo",null),e([M({type:Boolean})],r.prototype,"slicePlaneEnabled",void 0),e([M()],r.prototype,"supportedTextureEncodings",null),e([M()],r.prototype,"uncompressedTextureDownsamplingEnabled",null),e([M({type:[te]})],r.prototype,"_modifications",void 0),e([M()],r.prototype,"_elevationTask",void 0),e([M({readOnly:!0})],r.prototype,"_usePBR",null),r=e([C(_t)],r),r};function It(e,t){m(e)||mt.warn("Error while processing edges. Edges on this layer might not display correctly",t,e)}var Mt;!function(e){e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.UPDATE=2]="UPDATE"}(Mt||(Mt={}));const Ct=K(),xt=Y(),Ot=Y(),Et=st(),St=[0,0,0,0],jt=new t([0,0,0,0]),wt=[0,0,0,0];function Tt(e){if(c(e))return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function At(e){return"geometryData"in e}function Dt(e){return h(e)&&v(e.data)}function Rt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(h(t))for(const s of t)h(s)&&v(s.data)&&(i+=s.data.byteLength);return i}function Nt(e,t){return t.byteSize>yt?(mt.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function Pt(e){if(0===e.length)return null;const t=10*e.length,i=new Float64Array(t);return e.forAll(((e,t)=>{let s=e.serviceObb;c(s)&&(s=Et,P(s.center,e.mbs),s.halfSize[0]=s.halfSize[1]=s.halfSize[2]=e.mbs[3]);const r=10*t;i[r+0]=s.center[0],i[r+1]=s.center[1],i[r+2]=s.center[2],i[r+3]=s.halfSize[0],i[r+4]=s.halfSize[1],i[r+5]=s.halfSize[2],i[r+6]=s.quaternion[0],i[r+7]=s.quaternion[1],i[r+8]=s.quaternion[2],i[r+9]=s.quaternion[3]})),i}const Ft={remove(){},pause(){},resume(){}};function Vt(e,t){e.forEach((e=>e.opacity=t))}var Ut;!function(e){e[e.Absolute=0]="Absolute",e[e.RelativeToGround=1]="RelativeToGround",e[e.OnTheGround=2]="OnTheGround"}(Ut||(Ut={}));const Ht=U(),Gt=K(),Lt="elevation-change";export{Ut as ElevationMode,vt as I3SMeshView3D};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{removeUnordered as s}from"../../../core/arrayUtils.js";import{ByteSizeUnit as r}from"../../../core/byteSizeEstimations.js";import o from"../../../core/Collection.js";import has from"../../../core/has.js";import a from"../../../core/Logger.js";import{someMap as n}from"../../../core/MapUtils.js";import{unwrapOr as l,destroyMaybe as d,isSome as h,isNone as c,applySome as u}from"../../../core/maybe.js";import _ from"../../../core/PooledArray.js";import{isAbortError as m,throwIfAborted as g,createResolver as p}from"../../../core/promiseUtils.js";import{initial as f,watch as b}from"../../../core/reactiveUtils.js";import{schedule as y}from"../../../core/scheduling.js";import{isArrayBuffer as v}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as I}from"../../../core/unitUtils.js";import{property as M}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as C}from"../../../core/accessorSupport/decorators/subclass.js";import{f as x}from"../../../chunks/mat3.js";import{c as O}from"../../../chunks/mat3f32.js";import{m as E,D as S}from"../../../chunks/mat4.js";import{b as j,c as w}from"../../../chunks/mat4f64.js";import{f as T}from"../../../chunks/quatf64.js";import{m as A,s as D,t as R,a as N,c as P,g as F,b as V}from"../../../chunks/vec3.js";import{c as U}from"../../../chunks/vec3f64.js";import{s as H}from"../../../chunks/vec4.js";import{f as G}from"../../../chunks/vec4f64.js";import{projectBuffer as L,getProjectorName as k,localLinearScaleFactors as B,projectVectorToVector as q,projectBoundingSphere as z}from"../../../geometry/projection.js";import{create as K,empty as W,expandWithBuffer as $,toRect as X}from"../../../geometry/support/aaBoundingBox.js";import{create as Y,intersects as Q}from"../../../geometry/support/aaBoundingRect.js";import{fallbackObjectIDAttribute as J}from"../../../layers/LayerConstants.js";import Z from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as ee}from"../../../layers/support/fieldUtils.js";import te from"../../../layers/support/SceneModification.js";import{getColor as ie,getOpacity as se}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as re}from"../../../support/arcadeOnDemand.js";import oe from"../../../symbols/Symbol3D.js";import{getMetersPerUnit as ae}from"../../../symbols/support/unitConversionUtils.js";import ne from"./I3SMeshViewLabeler.js";import{I3SMeshWorkerHandle as le,toWasmModification as de}from"./I3SMeshWorkerHandle.js";import{ForAllFeaturesReturnType as he,ForAllFeaturesVisibilityMode as ce}from"./II3SMeshView3D.js";import{initialize as ue,setModificationsSync as _e,filterObbsForModificationsSync as me,interpretObbModificationResults as ge}from"./SceneLayerWorker.js";import{overrideColor as pe}from"./graphics/graphicUtils.js";import{areLabelsVisible as fe}from"./graphics/Labeler.js";import{TextureUsage as be,TextureEncoding as ye}from"./i3s/enums.js";import ve from"./i3s/Highlights.js";import{I3SAsyncElevationUpdater as Ie}from"./i3s/I3SAsyncElevationUpdater.js";import{I3SCrossfadeHelper as Me,NodeCrossfadeMetaData as Ce}from"./i3s/I3SCrossfadeHelper.js";import xe from"./i3s/I3SElevationProvider.js";import{boundingBoxCornerPoints as Oe}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Ee}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as Se,selectEncoding as je,defaultMaterial as we,createTexture as Te,configureMaterial as Ae}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as De,NodeState as Re}from"./i3s/I3SNode.js";import{I3SOverrides as Ne}from"./i3s/I3SOverrides.js";import{computeGlobalTransformation as Pe,getLocalOrigin as Fe}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ve,checkSceneLayerValid as Ue,checkSceneLayerCompatibleWithView as He,getCacheKeySuffix as Ge,whenGraphicAttributes as Le,computeVisibilityObb as ke,filterInPlace as Be,getCachedAttributeValue as qe,intersectBoundingRectWithMbs as ze,MbsIntersectResult as Ke,addWraparound as We,getSymbolInfo as $e,transparentEdgeMaterial as Xe,getClipRect as Ye}from"./i3s/I3SUtil.js";import{IDBCache as Qe}from"./i3s/IDBCache.js";import{IDBMockCache as Je}from"./i3s/IDBMockCache.js";import{attributeLookup as Ze}from"./support/attributeUtils.js";import{ColorMixModeEnum as et}from"./support/symbolColorUtils.js";import tt from"../support/debugFlags.js";import{toBoundingRect as it}from"../support/extentUtils.js";import{create as st,clone as rt}from"../support/orientedBoundingBox.js";import{updatingProgress as ot}from"../support/updatingProperties.js";import{glLayout as at}from"../support/buffer/glUtil.js";import{State as nt}from"../webgl-engine/collections/Component/ComponentObject.js";import{createVertexBufferLayout as lt}from"../webgl-engine/collections/Component/SourceGeometry.js";import{TextureCoordinateAttributeType as dt}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasis as ht}from"../webgl-engine/lib/BasisUtil.js";import{newDoubleArray as ct}from"../webgl-engine/lib/DoubleArray.js";import{Transparency as ut}from"../webgl-engine/lib/edgeRendering/interfaces.js";const _t="esri.views.3d.layers.I3SMeshView3D",mt=a.getLogger(_t),gt=[1,1,1,1];class pt extends Ce{constructor(e,t,i,s,r,o,a){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.cachedMidsTerrainSR=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbology=null}}var ft;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(ft||(ft={}));const bt=19,yt=100*r.MEGABYTES,vt=t=>{let r=class extends t{constructor(...e){super(e),this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._currentRenderer=null,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._visibleGeometryChangedSchedulerHandle=null,this._idbCache=has("enable-feature:idb-mock-cache")?new Je:new Qe("esri-scenelayer-cache","geometries"),this._hasComponentData=!1,this._hasVertexColors=!1,this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._elevationTask=null,this._filters=[],this._arcade=null,this._tmpAttributeOnlyGraphic=new i(null,null,{}),this._crossfadeHelper=new Me(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get layerId(){return this.i3slayer&&this.i3slayer.id}get sublayerId(){return null}get updatingProgressValue(){return this._controller?.updatingProgress??0}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return Ve(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?be.AllTexturesPBR:be.AllTextures:this._usePBR||this._hasLoadedPBRTextures?be.GeometryTexturesPBR:be.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=I(this.i3slayer.spatialReference),i=ae(e.unit);return l(e.offset,0)*i/t}return 0}get elevationInfo(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null==e)return{mode:Ut.Absolute,offset:0};const t=I(this.i3slayer.spatialReference),i=ae(e.unit),s=l(e.offset,0)*i/t;switch(e.mode){case"absolute-height":return{mode:Ut.Absolute,offset:s};case"relative-to-ground":return{mode:Ut.RelativeToGround,offset:s};case"on-the-ground":return{mode:Ut.OnTheGround,offset:0};default:return{mode:Ut.Absolute,offset:0}}}get supportedTextureEncodings(){return Se(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){const e=this.view?.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,t=0==(this.supportedTextureEncodings&ye.DDS_S3TC);return e&&t}initialize(){this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController,t=e.memoryController;this.i3sOverrides=new Ne({view:this.view,layer:this.i3slayer,memoryController:t}),this._worker=new le((t=>e.immediate.schedule(t))),this.addResolvingPromise(this._worker.promise);const i=this.i3slayer.store;this._worker.setLegacySchema(this.uid,i.defaultGeometrySchema),Ue(this.i3slayer),He(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new Z({layerView:this}),this._gpuMemoryEstimate=0,this._texMemoryEstimate=0,this._geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this.resetHighlights();const s=i.defaultGeometrySchema;if(this._isIntegratedMesh||!s)this._hasComponentData=!1;else{const e=s.featureAttributes;this._hasComponentData=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=(s?.vertexAttributes.color??null)&&(null==this.i3slayer.cachedDrawingInfo||!this.i3slayer.cachedDrawingInfo.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderer.ensureEdgeView());const r=this.view.resourceController.memoryController.newCache(this.uid,(e=>this._deleteComponentObject(e)));this._memCache=r;const o=e=>h(this._controller.index)&&h(this._controller.index.rootNode)?this._controller.index.traverse(this._controller.index.rootNode,(t=>{const i=t.index,s=this._nodeId2Meta.get(i)||this._nodeId2MetaReloading.get(i);return e(t,h(s)?s.objectHandle:null)})):()=>{};this._intersectionHandler=new Ee({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:o}),this.updatingHandles.add((()=>this.layerUid),(e=>this._intersectionHandler.layerUid=e)),this.updatingHandles.add((()=>this.sublayerUid),(e=>this._intersectionHandler.sublayerUid=e)),this._elevationProvider=new xe({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this.updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),f),this.updatingHandles.add((()=>this.fullOpacity),(e=>this._opacityChange(e))),this.updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this.updatingHandles.add((()=>this.elevationOffset),((e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()})),this.updatingHandles.add((()=>this.elevationInfo),((e,t)=>this._elevationInfoChanged(e,t)),f),this.updatingHandles.add((()=>!this.suspended&&this.elevationInfo.mode!==Ut.Absolute),((e,t)=>{e?this.handles.add(this.view.basemapTerrain.on("elevation-change",(({extent:e})=>this._ensureElevationTask().addExtent(e))),Lt):t&&this.handles.remove(Lt)}),f),this.updatingHandles.add((()=>this._usePBR),(e=>this._updatePBR(e)));const a=()=>{this._reloadAll(),this.clearMemCache()};this.updatingHandles.add((()=>this.rendererTextureUsage),a),this.updatingHandles.add((()=>this.uncompressedTextureDownsamplingEnabled),a),this.updatingHandles.add((()=>this.suspended),(e=>this._suspendedChange(e)),f),this.updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),f),this.updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),f),this.handles.add([b((()=>tt.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&tt.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||tt.I3S_TREE_SHOW_TILES||(this._treeDebugger=d(this._treeDebugger))}),f),b((()=>tt.I3S_SHOW_MODIFICATIONS),(()=>this._showModifications()),f)]),this._cacheKeySuffix=Ge(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch((e=>mt.warn(`Failed to initialize IndexedDB cache: ${e}`)))}destroy(){this._clearAddTasks(),this._elevationTask=d(this._elevationTask),this.i3sOverrides=d(this.i3sOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=d(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=d(this._labeler),this._treeDebugger=d(this._treeDebugger),this._controller=d(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_memEstimateTextureAdded(e){const t=e.estimatedTexMemRequired;return this._gpuMemoryEstimate+=t,this._texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(h(e)){const t=e.estimatedTexMemRequired;this._gpuMemoryEstimate-=t,this._texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this._gpuMemoryEstimate+=t,this._geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this._gpuMemoryEstimate-=t,this._geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}getUsedMemory(){let e=h(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=h(t)?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=h(t)?t.node.memory:0)),e}getUnloadedMemory(){return(h(this._controller)?this._controller.unloadedMemoryEstimate:0)+(h(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!(fe(this.i3slayer)&&this._supportsLabeling))return void(h(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(h(this._labeler))return;const e=new ne({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach((t=>h(t)&&this._addMetaToLabeler(e,t))),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then((e=>(--this._asyncModuleLoading,e)),(e=>{throw--this._asyncModuleLoading,e}))}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=ue().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=de(this._layerClippingArea,this._modifications,t);_e({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new _:null;this._nodeId2Meta.forEach(((e,t)=>{c(e)?(this._nodeId2Meta.delete(t),this._controller.updateLoadStatus(t,!1)):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):h(s)&&s.push(e.node)})),h(s)&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),h(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==De.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),h(t)?(this._nodeId2Meta.delete(e.index),this._nodeId2MetaReloading.set(e.index,t)):this._nodeId2Meta.has(e.index)&&(this._nodeId2Meta.delete(e.index),this._controller.updateLoadStatus(e.index,!1))}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(h(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!tt.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){const r=s.geometry;r.spatialReference=this.i3slayer.spatialReference;const o={...t,color:e[s.type]};this._modificationGraphics.push(new i({geometry:r,symbol:o}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_suspendedChange(e){e?(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler)):(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(h(t)&&h(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);h(i)&&h(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);h(s)&&(await this.i3sOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._controller.reschedule((()=>this._attributeValuesChanged(s)),i).catch((e=>{m(e)||mt.warn("Error while updating attribute values. Layer might not display correctly.",e)})))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,h(this._labeler)&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){h(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>h(t)&&e.push(t.node))),e}getNodeComponentObb(e){const t=this._nodeId2Meta.get(e.index)??this._nodeId2MetaReloading.get(e.index);return h(t)?this._collection.getComponentObb(t.objectHandle):null}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!has("disable-feature:i3s-basis")&&0!=(this.supportedTextureEncodings&ye.Basis)&&u(this.i3slayer.textureSetDefinitions,(e=>e.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))))&&ht()}_getVertexBufferLayout(e,t){const i={hasTexture:Tt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return at(lt(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||J}_findGraphicNodeAndIndex(e){const t=Ze(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return n(this._nodeId2Meta,(e=>{if(c(e))return!1;const s=e.featureIds.indexOf(t);return-1!==s&&(i={node:e.node,index:s},!0)})),i}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(c(i))return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=Ze(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._getAABB(t.node.index,t.index);return c(i)?Promise.reject():Promise.resolve({boundingBox:i,screenSpaceObjects:[]})}getAABBFromIntersectorTarget(e){return null==e.nodeIndex||null==e.componentIndex?null:this._getAABB(e.nodeIndex,e.componentIndex)}_getAABB(e,t){const i=this._nodeId2Meta.get(e);if(c(i)||null==i.featureIds||t>=i.featureIds.length)return null;const s=i.objectHandle,r=Oe(t,this._collection,s,ct(24)),o=this.view.renderSpatialReference,a=this.view.spatialReference;if(!L(r,o,0,r,a,0,8))return null;const n=W();return $(n,r,0,8),n}whenGraphicAttributes(e,t){return Le(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(h)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return c(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${bt}/${e.id}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return h(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){h(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(c(this._memCache))return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,e.node.memory,i)}loadMissingTextures(e,t,i,s){const r=e?.filter(((e,i)=>{if(0==(e.usage&this.rendererTextureUsage))return!1;if(c(t))return!0;const s=je(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(c(r)||null==r.data||s&&r.encoding!==s.encoding)}))??[];return 0===r.length?Promise.resolve(!1):i(r,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e)),null):(this.elevationInfo.mode===Ut.Absolute&&(e.geometryObb=s.geometryObb),this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&h(s.textureData)&&(s.byteSize=Rt(s.transformedGeometry,s.textureData),s.textureData.every(Dt)&&Nt(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch((t=>mt.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),g(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return At(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(c(s))return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,transformedGeometry:n}=s,l=this._controller.crsIndex,d=this.view.renderSpatialReference,u=Pe(e.mbs,this.elevationOffset,l,d),_=st([r.center.x,r.center.y,r.center.z],[r.extents.x,r.extents.y,r.extents.z],T(r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w));A(_.center,_.center,u),this.elevationInfo.mode===Ut.Absolute&&(e.geometryObb=_),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.from(a));const m={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:n,globalTrafo:u,geometryObb:_,byteSize:Rt(n,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&Nt(e,m)){const t=h(m.textureData)?m.textureData.map((e=>Dt(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e),{...m,textureData:t}).catch((t=>mt.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,m,i)}),i))))):Promise.reject()}computeVisibilityObb(e){return ke(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications)}_transformNode(e,t,i){const s=t.geometryData.geometries??[],r=new Array(s.length);for(let c=0;c<s.length;++c)r[c]=this._getVertexBufferLayout(s[c],t.geometryDescriptor);const o=e.mbs,a=this.elevationOffset,n=this._controller.crsIndex,l=this._controller.crsVertex,d=this.view.renderSpatialReference,h=Fe(o,a,n),u=Pe(o,a,n,d),_=k(n,l),m=k(l,d);if(c(_)||c(m))return Promise.resolve(null);const g={context:this.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,localOrigin:h,globalTrafo:u,mbs:o,obb:e.serviceObb,elevationOffset:a,needNormals:!this._isIntegratedMesh&&this._controller.isMeshPyramid,normalReferenceFrame:this.i3slayer.normalReferenceFrame||"none",indexToVertexProjector:_,vertexToRenderProjector:m};return this._worker.invoke(g,i)}get _supportsNodeCrossFading(){return!this.view?._stage?.renderer.shadowsEnabled}get nodeCrossfadingEnabled(){return this._supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this._supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(this.elevationInfo.mode===Ut.Absolute&&(e.geometryObb=rt(this._collection.getComponentObb(t.objectHandle))),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);h(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,nt.Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this.elevationInfo.mode!==Ut.Absolute&&this._ensureElevationTask().schedule(s),this._updateEngineObject(t),this._highlights.objectCreated(t),h(this._treeDebugger)&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async _addCachedNodeData(e,t,i){if(this.suspended||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(c(t))return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:o,globalTrafo:a}=t;await this.i3sOverrides.apply(r.featureIds,s.attributeInfo,i);const n=h(t.textureData)?t.textureData.filter((e=>h(e)&&0!=(e.usage&this.rendererTextureUsage))):[];!has("disable-feature:i3s-basis")&&n.some((e=>h(e)&&(e.encoding===ye.Basis||e.encoding===ye.KTX2)))&&await ht(),e.memory=0;const{componentOffsets:l,geometries:d,featureIds:u}=r,_=this._collection,m=d[0],{layout:g,indices:p,interleavedVertexData:f,positionData:b,hasColors:y}=o,v=this._materialParameters(m,g),I=l||new Uint32Array([0,p?p.length:f.byteLength/g[0].stride]),M={vertices:{data:f,count:f.byteLength/g[0].stride,layoutParameters:v.geometryParams},positionData:{positions:b.data,indices:b.indices},indices:p,componentOffsets:I},C=m.transformation?j(m.transformation):w();E(C,a,C);const T=S(U(),C),A=x(O(),C),D=this.view.renderSpatialReference,R=this.view.basemapTerrain.spatialReference,N=U(),P=[1,1,1];B(T,D,P,R)||mt.errorOnce("Unsupported coordinate system for IM overlay"),q(T,D,N,R);const F=_.createObject({toMapSpace:G(N[0],N[1],P[0],P[1]),geometry:M,obb:t.geometryObb,transform:{position:T,rotationScale:A}}),V=v.geometryParams.textureCoordinates===dt.Atlas,{textures:H,texturePromise:L}=this._initMaterialAndTextures(F,v.material,n,V);e.memory+=this._memEstimateGeometryAdded(F),e.memory+=H.reduce(((e,t)=>e+(h(t)?this._memEstimateTextureAdded(t):0)),0);const k=!!v.material.hasParametersFromSource,z="blend"!==v.material.alphaMode&&v.material.metallicRoughness.baseColorFactor[3]>=1,K=new pt(e,u,F,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:k,isOpaque:z},H);s.meta=K,!this._hasTextures&&t.requiredTextures?.some((({usage:e})=>0!=(e&be.ColorTextures)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||y,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const W=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(K),L]).then((([t,s])=>(h(t)&&t.updateObjectVisibility(K.objectHandle,!1).catch((e=>It(e,this.i3slayer.title))),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(this._addNodeMeta(e.index,K),i.meta=null,this.suspended)return void this._removeNodeStageData(e.index,this.elevationOffset);_.setObjectVisibility(F,nt.Visible),h(t)&&t.updateObjectVisibility(K.objectHandle,!0).catch((e=>It(e,this.i3slayer.title))),K.attributeInfo=i.attributeInfo;const s=K.cachedRendererVersion!==this._rendererVersion,r=W!==this.slicePlaneEnabled;this._updateElevationOffsets(K);const o=K.elevationOffsets;this._updateComponentData(K);const a=this._applyFiltersToNode(K);(s||h(t)&&(r||a||o))&&this._addOrUpdateEdgeRendering(K),h(this._labeler)&&this._addMetaToLabeler(this._labeler,K),this._visibleGeometryChanged(K,Mt.ADD),this._highlights.objectCreated(K),this._updateMaterial(K),this._setNewNodeOpacity(K),h(this._treeDebugger)&&this._treeDebugger.update()}),i)))).catch((e=>{throw h(s.meta)&&(this._cacheGPUData(s.meta),s.meta=null),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){mt.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);h(t)&&this._deleteComponentObject(t)}else this._controller.updateLoadStatus(e,!0);h(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Vt(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_updateElevationOffsets(e){const t=this.view.renderSpatialReference,i=this.elevationInfo,s=this.view.basemapTerrain,r=s.spatialReference,o=i.mode;if(c(t)||c(r)||o===Ut.Absolute)return void(e.elevationOffsets=null);const a=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const n=Ht,l=Gt,d=o===Ut.OnTheGround,u=this.view.renderCoordsHelper,_=!!e.cachedMidsTerrainSR,m=e.featureIds.length;if(!_){e.cachedMidsTerrainSR=ct(3*m);const i=e.cachedMidsTerrainSR;for(let s=0;s<m;s++){this._collection.getComponentAabb(e.objectHandle,s,l,!0),D(n,(l[0]+l[3])/2,(l[1]+l[4])/2,l[2]),R(n,n,a.rotationScale),N(n,n,a.position);const o=3*s;i[o+2]=u.getAltitude(n),q(n,t,n,r),i[o+0]=n[0],i[o+1]=n[1]}}const g=e.cachedMidsTerrainSR,p=i.offset,f=e.elevationOffsets,b=(e,t)=>{const i=d?g[3*e+2]:0;f[e]=p+(h(t)?t-i:0)};s.getElevations(g,m,b)}_ensureElevationTask(){return h(this._elevationTask)||(this._elevationTask=new Ie(this.view.resourceController.scheduler,(e=>{const t=this._controller.updateElevationChanged(e,this.view.basemapTerrain.spatialReference);return h(t)?t.filterInPlace((e=>h(this._nodeId2Meta.get(e)))):null}),(e=>{const t=this._nodeId2Meta.get(e);this._nodeElevationAlignmentChanged(t)}))),this._elevationTask}_elevationInfoChanged(e,t){const i=e.mode!==Ut.Absolute,s=!!t&&t!==e&&t.mode!==Ut.Absolute;this._intersectionHandler.updateElevationAlignState(i,this.view.state.viewingMode),i&&!s&&this._controller.removeAllGeometryObbs(),this._nodeId2Meta.forEach((e=>this._nodeElevationAlignmentChanged(e)))}_nodeElevationAlignmentChanged(e){c(e)||(this._updateElevationOffsets(e),this._updateComponentData(e),this._updateEdgeRendering(e),h(this._labeler)&&this._labeler.updateLabelPositions(e),this._updateSnappingSources(e,Mt.UPDATE))}_safeReschedule(e,t){return g(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=h(e.params.material)?e.params.material:we(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=Tt(i);return{geometryParams:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>Te(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=Ae(e,t,o,i,this.view._stage.renderView.textureRepository,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?dt.Atlas:dt.Default:dt.None,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,i){let s=this._addTasks.get(e.index);return s?s.attributeInfo=t:(s={...p(),attributeInfo:t,meta:null},this._addTasks.set(e.index,s),i().then(s.resolve,s.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))),s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{h(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=Y();this._renderClippingArea=it(this.view.clippingArea,i,e)?i:null;const s=Y();this._layerClippingArea=it(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}get hasGeometryFilter(){return!1}_geometryFilterChange(){const e=this.hasGeometryFilter;this._controller.geometryFilterChanged(e),this._applyFilters(e)}_filterChange(){this._applyFilters(this.hasGeometryFilter)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{h(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,Mt.UPDATE))}))}getFilters(){const e=[],t=this._renderClippingArea;return h(t)&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(h(t)){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,d=h(t.attributeInfo)&&t.attributeInfo.attributeData;s.every((e=>e===n||d&&null!=d[e]))&&Be(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=d?qe(d[i],e):null);try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return z(e.node.mbs,this._controller.crsIndex,wt,this.view.renderSpatialReference),ze(t,wt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,Ct),X(Ct,xt),Q(i,xt)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===Ke.INSIDE)return;if(r===Ke.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(Ot,i,t.objectHandle);Be(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}_addOrUpdateEdgeRendering(e,t=!0){const i=this._edgeView;if(c(i))return Promise.resolve(null);const s=e.objectHandle,r=i.hasObject(s),{hasEdges:o,perFeatureEdgeMaterials:a}=this._getFilteredEdgeMaterials(e),n={hasSlicePlane:this.slicePlaneEnabled};if(o&&r){if(this.nodeCrossfadingEnabled){Vt(a,this.getNodeOpacity(e))}return i.updateAllComponentMaterials(s,a,n,t).catch((e=>It(e,this.i3slayer.title))),i.updateObjectVisibility(s,!0).catch((e=>It(e,this.i3slayer.title))),i.updateAllVerticalOffsets(s,e.elevationOffsets).catch((e=>It(e,this.i3slayer.title))),Promise.resolve(i)}return o&&!r?this._collection.addEdges(s,i,a,n).then((t=>(e.edgeMemoryUsage=t,e.node.memory+=t,i.updateAllVerticalOffsets(s,e.elevationOffsets).catch((e=>It(e,this.i3slayer.title))),i))):(!o&&r&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,i.removeObject(s)),Promise.resolve(null))}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(h(this._labeler)&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=0===t.getComponentCount(e.objectHandle).invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!i;if(this._updateCachedFilteredIds(e),e.filteredIds===e.featureIds)return!i;const s=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,s),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array,i=e.filteredIds;return h(i)&&e.featureIds.forEach(((e,s)=>{i[t.length]===e&&t.push(s)})),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach(((t,i)=>this._removeNodeStageData(i,e))),this._nodeId2MetaReloading.forEach(((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading))),this._elevationTask=d(this._elevationTask)}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading),h(this._elevationTask)&&this._elevationTask.remove(e)}_removeNodeStageData(e,t,i=this._nodeId2Meta){i.has(e)&&this._controller.updateLoadStatus(e,!1);const s=i.get(e);c(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,nt.Hidden),h(this._edgeView)&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1).catch((e=>It(e,this.i3slayer.title))),this._visibleGeometryChanged(s,Mt.REMOVE),h(this._labeler)&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),h(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(h(this._edgeView)&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);h(i)&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===Re.Hole))}_invalidateAllSymbols(){this._rendererVersion=We(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return We(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=We(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await re()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:mt.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&mt.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getComponentParameters(e){this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(i,s)=>{const r=5*i;if(H(s.externalColor,t[r+0]/255,t[r+1]/255,t[r+2]/255,t[r+3]/255),h(this._stage.renderView.objectAndLayerIdRenderHelper)){const t=e.featureIds[i];this._stage.renderView.objectAndLayerIdRenderHelper.setUidToObjectAndLayerId(t,t,this.layerId,this.layerUid,this.layerPopupEnabled,e.node.resources.attributes,i,this.sublayerId),s.objectAndLayerIdColor=this._stage.renderView.getObjectAndLayerIdColor({graphicUid:t,layerUid:this.layerUid})}s.externalColorMixMode=t[r+4]&(1<<ft.CastShadows)-1,s.castShadows=0!=(t[r+4]&1<<ft.CastShadows),s.pickable=0!=(t[r+4]&1<<ft.Pickable),s.elevationOffset=e.elevationOffsets?.[i]??0}}_getSymbolInfo(e,t){const i=e&&e.getSymbol(t,{arcade:this._arcade});if(!(i instanceof oe))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=$e(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=h(this._symbologyOverrideFields)&&this._symbologyOverrideFields.length>0?h(this._rendererFields)&&this._rendererFields.length>0?ee(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasComponentData)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=h(e.attributeInfo)&&e.attributeInfo.attributeData,o=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&h(this._symbologyFields)&&this._symbologyFields.length>0;let n=null,l=null;if(a&&h(this._symbologyFields)){n=[],l=[];for(const e of this._symbologyFields){const t=r[e];t&&(n.push(e),l.push(t))}}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const d={color:St,castShadows:!0,pickable:!0,colorMixMode:et.Multiply,edgeMaterial:null},u=this.fullOpacity,_=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):u;let m=null,g=ut.OPAQUE,p=Xe,f=0;for(let b=0;b<e.featureIds.length;b++){if(null!=o&&(i[o]=e.featureIds[b]),a&&n)for(let e=0;e<n.length;e++)i[n[e]]=qe(l[e],b);const r=s?this._getSymbolInfo(s,t):null;let u=null,y=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=ie(this._colorVariable,t,{color:jt,arcade:this._arcade});e&&(u=St,u[0]=e.r/255,u[1]=e.g/255,u[2]=e.b/255,this._opacityVariable||null===e.a||(y=e.a))}this._opacityVariable&&(y=se(this._opacityVariable,t,{arcade:this._arcade}))}if(r&&r.material){const e=r.material;u=c(u)||c(y)?pe(u,y,e.color,e.alpha,gt,St):pe(u,y,null,null,gt,St)}if(c(u)&&(u=St,u[0]=1,u[1]=1,u[2]=1,u[3]=1),d.pickable=!0,d.castShadows=!r||r.castShadows,d.colorMixMode=r&&r.material?r.material.colorMixMode:et.Multiply,d.edgeMaterial=r?r.edgeMaterial:null,h(this._symbologyOverride)&&(d.color=u,this._symbologyOverride(t,d),u=d.color),h(d.edgeMaterial)){const t=u[3]<=0?ut.INVISIBLE:u[3]>=1&&(e.material.isOpaque||d.colorMixMode===et.Replace)?ut.OPAQUE:ut.TRANSPARENT;d.edgeMaterial===m&&t===g||(p={...d.edgeMaterial,opacity:_,objectTransparency:t},m=d.edgeMaterial,g=t),e.cachedEdgeMaterials[b]=p}else e.cachedEdgeMaterials[b]=Xe;e.cachedSymbology[f+0]=Math.round(255*u[0]),e.cachedSymbology[f+1]=Math.round(255*u[1]),e.cachedSymbology[f+2]=Math.round(255*u[2]),e.cachedSymbology[f+3]=Math.round(255*u[3]),e.cachedSymbology[f+4]=d.colorMixMode|+d.castShadows<<ft.CastShadows|+d.pickable<<ft.Pickable,f+=5}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);this.nodeCrossfadingEnabled||Vt(t,this.fullOpacity);const i=e.filteredIds;if(c(i)){return{hasEdges:t.some((e=>e!==Xe)),perFeatureEdgeMaterials:t}}let s=0,r=!1;const o=t.map(((t,o)=>e.featureIds[o]!==i[s]?Xe:(r=r||t!==Xe,s++,t)));return{hasEdges:r,perFeatureEdgeMaterials:o}}_updateComponentData(e){if(!this._hasComponentData)return;const t=e.objectHandle,i=this._getComponentParameters(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Vt(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.usePBR=this._usePBR,this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._updateComponentData(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,Mt.UPDATE)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),h(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{c(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.commonMaterialParameters.hasSlicePlane=e)),this._updateEdgeRendering(t,!1))}))}_updatePBR(e){this._nodeId2Meta.forEach((t=>{c(t)||this._collection.updateMaterial(t.objectHandle,(t=>t.usePBR=e))})),this._hasLoadedPBRTextures=!0}get _usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){h(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=ce.VISIBLE_ONLY){n(this._nodeId2Meta,(s=>{if(c(s))return!1;if(h(t)){switch(t(s)){case he.EXIT:return!0;case he.SKIP:return!1}}let r=he.CONTINUE;switch(i){case ce.ALL:r=this._forAllFeaturesOfNode(s,e);break;case ce.VISIBLE_ONLY:r=this._forVisibleFeaturesOfNode(s,e);break;case ce.ALL_IN_CLIPPING_AREA:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return r===he.EXIT}))}_forAllFeaturesOfNode(e,t){let i=he.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===he.EXIT)return i;return i}_forVisibleFeaturesOfNode(e,t){let i=he.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===he.CONTINUE))),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(c(this._renderClippingArea))return this._forAllFeaturesOfNode(e,t);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===Ke.OUTSIDE)return he.CONTINUE;if(i===Ke.INSIDE)return this._forAllFeaturesOfNode(e,t);const s=he.CONTINUE,r=e.featureIds,o=e.objectHandle,a=Ye(this._renderClippingArea,this._collection.getObjectTransform(o));for(let n=0;n<r.length;n++){if(!this._boundingRectFeatureTest(e,n,a))continue;const i=t(r[n],n,e);if(i===he.EXIT)return i}return s}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=h(t.attributeInfo)&&t.attributeInfo.attributeData;if(h(s))for(const r of Object.keys(s))i[r]=qe(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e){const t=this._highlights;if("number"==typeof e||e instanceof i?e=[e]:e instanceof o&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof i){const i=e,s=this.i3slayer.fieldsIndex,r=this._getObjectIdField(),o=i.map((e=>Ze(s,e.attributes,r))),{set:a,handle:n}=t.acquireSet();return t.setFeatureIds(a,o),n}if("number"==typeof e[0]){const i=e,{set:s,handle:r}=t.acquireSet();return t.setFeatureIds(s,i),r}}return Ft}resetHighlights(){d(this._highlights),this._highlights=new ve({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,ce.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)})}_visibleGeometryChanged(e,t){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=y((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))),this._updateSnappingSources(e,t))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this._gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this._geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this._texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.getUnloadedMemory()/1048576).toFixed(1)+"MB"};return h(this._memCache)&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this;return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const t=[];return e._forAllFeatures((e=>(t.push(e),he.CONTINUE)),null,ce.VISIBLE_ONLY),t.sort(((e,t)=>e-t)),t},get numNodes(){return e._nodeId2Meta.size},get loadedNodes(){return Array.from(e._nodeId2Meta.keys()).sort(((e,t)=>e-t))}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return h(e)?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(((t,i)=>e(i,t)))}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);h(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);h(i)&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(c(this._edgeView)||!e.cachedEdgeMaterials)return;Vt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t).catch((e=>It(e,this.i3slayer.title)))}get hasModifications(){return this._isIntegratedMesh&&h(this._layerClippingArea)||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.uid,s=Pt(e);if(h(s)){const t={context:i,buffer:s.buffer};me(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=ge(i);e.imModificationImpact=s,s!==De.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||h(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0||h(this._elevationTask)&&this._elevationTask.running}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(c(s))throw new Error("invalid-node");const{origin:r,buffer:o}=await this._collection.extractEdgeInformation(s.objectHandle,t,i);return this._snappingLocationsApplyElevation(s,o,r),{type:"components",objectIds:s.featureIds,locations:o,origin:r}},remove:()=>{s(this._snappingSourcesTrackers,t)}};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach(((t,i)=>{if(c(t))return;const s=this._controller.getRenderMbs(t.node);h(s)&&e.add(i,s)})),t}_snappingLocationsApplyElevation(e,t,i){if(!e.elevationOffsets||this.elevationInfo.mode===Ut.Absolute)return;const s=t.position0,r=t.position1,o=t.componentIndex,a=U(),n=U(),l=(e,t)=>{N(e,e,i),this.view.renderCoordsHelper.worldUpAtPosition(e,n),N(e,e,F(n,n,t)),V(e,e,i)};for(let d=0;d<s.count;d++){const t=e.elevationOffsets[o.get(d)];s.getVec(d,a),l(a,t),s.setVec(d,a),r.getVec(d,a),l(a,t),r.setVec(d,a)}}_updateSnappingSources(e,t){const{index:i}=e.node,s=this._controller.getRenderMbs(e.node);if(!c(s))for(const r of this._snappingSourcesTrackers)t!==Mt.REMOVE&&t!==Mt.UPDATE||r.events.remove(i),t!==Mt.ADD&&t!==Mt.UPDATE||r.events.add(i,s)}};return e([M()],r.prototype,"_hasLoadedPBRTextures",void 0),e([M()],r.prototype,"_asyncModuleLoading",void 0),e([M()],r.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([M()],r.prototype,"view",void 0),e([M()],r.prototype,"i3slayer",void 0),e([M()],r.prototype,"_controller",void 0),e([M()],r.prototype,"_labeler",void 0),e([M()],r.prototype,"updating",void 0),e([M()],r.prototype,"suspended",void 0),e([M()],r.prototype,"holeFilling",void 0),e([M(ot)],r.prototype,"updatingProgress",void 0),e([M()],r.prototype,"updatingProgressValue",null),e([M()],r.prototype,"hasTexturesOrVertexColors",null),e([M()],r.prototype,"rendererTextureUsage",null),e([M()],r.prototype,"elevationOffset",null),e([M()],r.prototype,"elevationInfo",null),e([M({type:Boolean})],r.prototype,"slicePlaneEnabled",void 0),e([M()],r.prototype,"supportedTextureEncodings",null),e([M()],r.prototype,"uncompressedTextureDownsamplingEnabled",null),e([M({type:[te]})],r.prototype,"_modifications",void 0),e([M()],r.prototype,"_elevationTask",void 0),e([M({readOnly:!0})],r.prototype,"_usePBR",null),r=e([C(_t)],r),r};function It(e,t){m(e)||mt.warn("Error while processing edges. Edges on this layer might not display correctly",t,e)}var Mt;!function(e){e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.UPDATE=2]="UPDATE"}(Mt||(Mt={}));const Ct=K(),xt=Y(),Ot=Y(),Et=st(),St=[0,0,0,0],jt=new t([0,0,0,0]),wt=[0,0,0,0];function Tt(e){if(c(e))return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function At(e){return"geometryData"in e}function Dt(e){return h(e)&&v(e.data)}function Rt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(h(t))for(const s of t)h(s)&&v(s.data)&&(i+=s.data.byteLength);return i}function Nt(e,t){return t.byteSize>yt?(mt.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function Pt(e){if(0===e.length)return null;const t=10*e.length,i=new Float64Array(t);return e.forAll(((e,t)=>{let s=e.serviceObb;c(s)&&(s=Et,P(s.center,e.mbs),s.halfSize[0]=s.halfSize[1]=s.halfSize[2]=e.mbs[3]);const r=10*t;i[r+0]=s.center[0],i[r+1]=s.center[1],i[r+2]=s.center[2],i[r+3]=s.halfSize[0],i[r+4]=s.halfSize[1],i[r+5]=s.halfSize[2],i[r+6]=s.quaternion[0],i[r+7]=s.quaternion[1],i[r+8]=s.quaternion[2],i[r+9]=s.quaternion[3]})),i}const Ft={remove(){},pause(){},resume(){}};function Vt(e,t){e.forEach((e=>e.opacity=t))}var Ut;!function(e){e[e.Absolute=0]="Absolute",e[e.RelativeToGround=1]="RelativeToGround",e[e.OnTheGround=2]="OnTheGround"}(Ut||(Ut={}));const Ht=U(),Gt=K(),Lt="elevation-change";export{Ut as ElevationMode,vt as I3SMeshView3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{binaryIndexOf as r}from"../../../core/arrayUtils.js";import i from"../../../core/Logger.js";import{destroyMaybe as s,isNone as o,isSome as a,unwrap as n}from"../../../core/maybe.js";import{initial as d,watch as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{s as c}from"../../../chunks/vec3.js";import{c as p}from"../../../chunks/vec3f64.js";import{projectBuffer as g,projectVectorToVector as m}from"../../../geometry/projection.js";import{extentContainsCoords3D as f}from"../../../geometry/support/contains.js";import{getGeometryZScaler as y}from"../../../geometry/support/zscale.js";import{fallbackObjectIDAttribute as _}from"../../../layers/LayerConstants.js";import{makeDehydratedPoint as b,estimateSize as v}from"../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as x}from"../../../layers/graphics/hydratedFeatures.js";import E from"../../../layers/graphics/controllers/I3SOnDemandController.js";import I from"../../../layers/support/FeatureFilter.js";import w from"../../../rest/support/Query.js";import{I3SPointsWorkerHandle as N}from"./I3SPointsWorkerHandle.js";import{LayerView3D as C}from"./LayerView3D.js";import D from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as O}from"./graphics/QueryEngine.js";import{createInteractiveEditSession as F,processAttributeEdits as j}from"./i3s/attributeEditing.js";import{I3SGraphicsMap as S}from"./i3s/I3SGraphicsMap.js";import{I3SOverrides as G}from"./i3s/I3SOverrides.js";import{checkSpatialReferences as A,containsDraco as L,whenGraphicAttributes as P,getCachedAttributeValue as V}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as M}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as R}from"./support/fieldProperties.js";import{PopupSceneLayerView as H}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as U}from"./support/SceneLayerViewRequiredFields.js";import q from"../support/debugFlags.js";import{compute as Q}from"../support/orientedBoundingBox.js";import{updatingProgress as T}from"../support/updatingProperties.js";import{Attribute as B}from"../webgl-engine/lib/Attribute.js";import{newDoubleArray as k}from"../webgl-engine/lib/DoubleArray.js";import{UpdatePolicy as z}from"../webgl-engine/lib/UpdatePolicy.js";import W from"../../layers/SceneLayerView.js";import{TaskPriority as Z}from"../../support/Scheduler.js";const K=R();let Y=class extends(M(H(C(W)))){constructor(){super(...arguments),this.type="scene-layer-graphics-3d",this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this.loadedGraphics=new S(((e,t,r)=>ee(e,t,r)),(e=>this.processor.graphicsCore.recreateGraphics(e))),this.holeFilling="always",this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}initialize(){const e=this.layer;this.addResolvingPromise(e.indexInfo),this._i3sOverrides=new G({view:this.view,layer:this.layer,memoryController:this.view.resourceController?.memoryController}),A(e,this.view.spatialReference,this.view.viewingMode),this._fieldsHelper=new U({layerView:this}),this.updatingHandles.add((()=>this.layer.rangeInfos),(e=>this._rangeInfosChanged(e)),d),this.updatingHandles.add((()=>e.renderer),((e,t)=>this._rendererChange(e,t))),this.updatingHandles.add((()=>[this.parsedDefinitionExpression,this._excludeObjectIdsSorted]),(()=>this._filterChange())),this.handles.add(l((()=>q.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&q.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||!this._treeDebugger||q.I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)}),d)),this._set("processor",new D({owner:this,preferredUpdatePolicy:z.ASYNC,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,setUidToIdOnAdd:!1,dataExtent:e.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),this.processor.elevationAlignment?.events.on("invalidate-elevation",(e=>this._controller.updateElevationChanged(e.extent,e.spatialReference))),this.supportsHeightUnitConversion&&(this._verticalScale=y("point",e.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.initializePromise),this._memCache=this.view.resourceController.memoryController.newCache(e.uid),this._controller=new E({layerView:this,scaleVisibilityEnabled:!1}),L(this.layer.geometryDefinitions)&&(this._worker=new N((e=>this.view.resourceController.immediate.schedule(e)))),this.handles.add(this.layer.on("apply-edits",(e=>this.updatingHandles.addPromise(e.result)))),this.handles.add(this.layer.on("edits",(e=>this._handleEdits(e)))),this.when((()=>{this._setupQueryEngine(),this.updatingHandles.add((()=>this.maximumNumberOfFeatures),(e=>this._controller.featureTarget=e),d),this.updatingHandles.add((()=>this.suspended),(e=>{e&&this._removeAllNodeData()}))}))}destroy(){this._treeDebugger=s(this._treeDebugger),this._i3sOverrides=s(this._i3sOverrides),this._set("processor",s(this.processor)),this._controller=s(this._controller),this._queryEngine=s(this._queryEngine),this._worker=s(this._worker),this._memCache=s(this._memCache),this.loadedGraphics.clear(),this._fieldsHelper=s(this._fieldsHelper)}get i3slayer(){return this.layer}get updatingProgressValue(){return this._controller?.updatingProgress??1}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get maximumNumberOfFeatures(){const e=this.processor?.graphicsCore?.displayFeatureLimit;return e?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){null!=e?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){return!this.suspended&&(!!this._controller?.useMaximumNumberOfFeatures&&!this._controller.leavesReached)}get _excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds;return e.length?e.toArray().sort(((e,t)=>e-t)):null}get lodFactor(){return"Labels"===this.layer.semantic?1:this.view.qualitySettings.sceneService.point.lodFactor}get hasM(){return!1}get hasZ(){return!0}async whenGraphicAttributes(e,t){return P(this.layer,e,this._getObjectIdField(),t,(()=>[...this.loadedGraphics.nodes()]))}getHit(e){if(!this.loadedGraphics)return null;const t=x(this.loadedGraphics.find((t=>t.uid===e)),this.layer),r=this._getObjectIdField();return t&&t.attributes&&t.attributes[r]?(t.layer=this.layer,t.sourceLayer=this.layer,{type:"graphic",graphic:t,layer:t.layer}):null}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}isUpdating(){return!!(this._controller?.updating||this.processor?.updating||this._fieldsHelper?.updating||this.layerFilterUpdating)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return F(this._attributeEditingContext,e)}async _decompressBinaryPointData(e,t){const r={geometryBuffer:e.geometryBuffer};o(this._worker)&&(this._worker=new N((e=>this.view.resourceController.immediate.schedule(e))));const i=await this._worker.invoke(r,t);if(o(i))throw new Error("Failed to decompress Draco point data");return{positionData:i.positions,featureIds:i.featureIds}}async addNode(e,t,r){if(!X(t)&&!J(t))throw new Error;if(this.loadedGraphics.hasNode(e.index))return void i.getLogger(this.declaredClass).error("I3S node "+e.id+" already added");const s=a(this.layer.fullExtent)?re(this.layer.fullExtent.clone(),.5):null,o=[],{featureIds:n,pointPositions:d}=X(t)?await this._extractBinaryPointPositions(e,t,r):this._extractLegacyPointPositions(t);this._validatePositions(e,n,d,s,o);const l=this._controller.crsVertex,h=this.view.spatialReference;g(d,l,0,d,h,0,n.length);const u=X(t)?e.level:0,c={graphics:this._createGraphics(n,d,e.index,u),featureIds:n,attributeInfo:t.attributeDataInfo,node:e};if(await this._i3sOverrides.apply(c.featureIds,t.attributeDataInfo,r),e.numFeatures=c.graphics.length,this._updateNodeMemory(e),te(c),o.length>0&&(this._computeObb(e,o,l),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e))return void this._cacheNodeData(c);if(a(this._verticalScale))for(const i of c.graphics)this._verticalScale(i.geometry);const p=this.view._stage.renderView.objectAndLayerIdRenderHelper;if(a(p))for(let i=0;i<c.featureIds.length;i++){const e=c.featureIds[i];p.setUidToObjectAndLayerId(e,c.graphics[i].uid,this.layer.id,this.layer.uid,this.layer.popupEnabled,c.node.resources.attributes,i)}this.loadedGraphics.addNode(e.index,c),this._controller.updateLoadStatus(e.index,!0),this._filterNode(c),this._treeDebugger&&this._treeDebugger.update()}_computeObb(e,t,r){const i=this._controller.crsIndex,s=i.isGeographic?this.view.renderSpatialReference:i;g(t,r,0,t,s,0,t.length/3),e.serviceObb=Q(new B(t,3)),i.isGeographic&&m(e.serviceObb.center,s,e.serviceObb.center,i)}isNodeLoaded(e){return this.loadedGraphics.hasNode(e)}isNodeReloading(){return!1}updateNodeState(){}async _extractBinaryPointPositions(e,t,r){const i=await this._decompressBinaryPointData(t,r),s=i.positionData,o=3,n=s.length/o,d=k(3*n),l=a(e.serviceObb)?e.serviceObb.center:[0,0,0],h=Math.abs(l[2])*2**-20;for(let a=0;a<n;a++){const e=a*o;d[e+0]=s[e+0]+l[0],d[e+1]=s[e+1]+l[1],d[e+2]=s[e+2]+l[2],Math.abs(d[e+2])<h&&(d[e+2]=0)}return{featureIds:i.featureIds?Array.from(i.featureIds):[],pointPositions:d}}_extractLegacyPointPositions(e){const t=e.pointData.length,r=k(3*t),i=new Array;for(let s=0;s<t;s++){const t=e.pointData[s],o=t.featureDataPosition,a=o.length,n=t.geometries?.[0]??ie[a],d=t.featureIds[0];if("Embedded"!==n.type||"points"!==n.params.type||a<2||a>3)continue;const l=n.params.vertexAttributes?.position??[0,0,0],h=3*i.length;r[h+0]=o[0]+l[0],r[h+1]=o[1]+l[1],r[h+2]=3===a?o[2]+l[2]:NaN,i.push(d)}return{featureIds:i,pointPositions:r}}_validatePositions(e,t,r,s,n){if(o(s)&&e.serviceObb)return;const d=t.length,l=3;for(let o=0;o<d;o++){const t=o*l;c(se,r[t],r[t+1],r[t+2]),a(s)&&!f(s,se)&&(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&i.getLogger(this.declaredClass).error("Service Error: Coordinates outside of layer extent"),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&i.getLogger(this.declaredClass).error("Maximum number of errors reached. Further errors are ignored."),this._coordinatesOutsideExtentErrors++),e.serviceObb||n.push(se[0],se[1],se[2])}}_createGraphics(e,r,i,s){const o=e.length,d=3,l=this._getObjectIdField(),h=this.processor.graphicsCore,u=new Array,c=this.view.spatialReference;for(let p=0;p<o;p++){const o=e[p],g={};null!=o&&(g[l]=o);const m=o??t.generateUID(),f=p*d,y=isNaN(r[f+2])?void 0:r[f+2],_=b(r[f],r[f+1],y,c),v=this.loadedGraphics.get(m);if(a(v))(null==v.level||v.level<s)&&(oe.property="geometry",oe.graphic=v,oe.oldValue=n(v.geometry),oe.newValue=_,v.geometry=_,v.level=s,h.graphicUpdateHandler(oe)),u.push(v);else{const e=t.generateUID();u.push({objectId:m,uid:e,geometry:_,attributes:g,visible:!0,nodeIndex:i,level:s})}}return u}_updateNodeMemory(e){e.memory=4096+(a(e.numFeatures)?e.numFeatures*this.processor.graphicsCore.usedMemoryPerGraphic:0)}_cacheNodeData(e){const t=e.graphics.reduce(((e,t)=>v(t)+e),512+8*e.featureIds.length+1024);this._memCache.put(this._getMemCacheKey(e.node),e,t)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this.loadedGraphics.forEachNode(((e,t)=>{if(e){const t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}this._controller.updateLoadStatus(t,!1)})),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this.loadedGraphics.getNode(e);return o(t)?null:(this._controller.updateLoadStatus(e,!1),this.loadedGraphics.removeNode(e),this._treeDebugger&&this._treeDebugger.update(),t)}async loadCachedNodeData(e){return this._memCache?.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,t,r,s){this.loadedGraphics.hasNode(e.index)?i.getLogger(this.declaredClass).error("I3S node "+e.id+" already added"):(await this._i3sOverrides.apply(t.featureIds,r,s),this.loadedGraphics.addNode(e.index,t),this._controller.updateLoadStatus(e.index,!0),this._updateNodeMemory(e),t.attributeInfo=r,this._attributeValuesChanged(t),this._filterNode(t),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){const e=[];return this.loadedGraphics.forEachNode((t=>e.push(t.node.id))),e.sort()}getVisibleNodes(){const e=new Array;return this.loadedGraphics.forEachNode((t=>e.push(t.node))),e}getLoadedNodeIndices(e){this.loadedGraphics.forEachNode(((t,r)=>e.push(r)))}getLoadedAttributes(e){const t=this.loadedGraphics.getNode(e);if(a(t)&&a(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this.loadedGraphics.getNode(e);if(a(t)&&a(t.attributeInfo))return t.attributeInfo.attributeData}_setAttributeData(e,t){const r=this.loadedGraphics.getNode(e);o(r)||o(r.attributeInfo)||(r.attributeInfo.attributeData=t,this._attributeValuesChanged(r))}async updateAttributes(e,t,r){const i=this.loadedGraphics.getNode(e);o(i)||(await this._i3sOverrides.apply(i.featureIds,t,r),i.attributeInfo=t,this._attributeValuesChanged(i))}_attributeValuesChanged(e){if(te(e),this._filterNode(e),this.processor.graphicsCore.labelsEnabled){const t=e.graphics.map((e=>e.uid));this.processor.graphicsCore.updateLabelingInfo(t)}}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||_}async _rendererChange(e,t){const{layer:{fieldsIndex:r}}=this,i=new Set;let s,o;e?(await e.collectRequiredFields(i,r),s=Array.from(i).sort()):s=[],i.clear(),t?(await t.collectRequiredFields(i,r),o=Array.from(i).sort()):o=[],s.length===o.length&&s.every(((e,t)=>s[t]===o[t]))||this._reloadAllNodes()}_rangeInfosChanged(e){null!=e&&e.length>0&&i.getLogger(this.declaredClass).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}_filterChange(){this.loadedGraphics.forEachNode((e=>this._filterNode(e)))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){const t=this.parsedDefinitionExpression,i=this._excludeObjectIdsSorted,s=this._getObjectIdField();for(const a of e.graphics){const e=a.visible,n=!t||this._evaluateClause(t,a),d=o(i)||r(i,a.attributes[s])<0;a.visible=n&&d,e!==a.visible&&(oe.graphic=a,oe.property="visible",oe.oldValue=e,oe.newValue=a.visible,this.processor.graphicsCore.graphicUpdateHandler(oe))}}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return a(this.filter)?this.filter.createQuery(e):new w(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(o(e)?this.createQuery():w.from(e))}_setupQueryEngine(){const e=()=>this.processor.featureStore;this._queryEngine=new O({context:{spatialReference:this.view.spatialReference,layer:this.layer,scheduler:this.view.resourceController.scheduler,get featureStore(){return e()},hasZ:this.hasZ,hasM:this.hasM},priority:Z.FEATURE_QUERY_ENGINE})}getUsedMemory(){return this.processor?.graphicsCore?.usedMemory??0}getUnloadedMemory(){return.8*((this._controller?.unloadedMemoryEstimate??0)+(this.processor?.graphicsCore?.unprocessedMemoryEstimate??0))}ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}_handleEdits(e){j(this._attributeEditingContext,e)}get _attributeEditingContext(){const e=this._getObjectIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,forEachNode:e=>this.loadedGraphics.forEachNode((t=>e(t.node,t.featureIds))),attributeStorageInfo:this.i3slayer.attributeStorageInfo??[],i3sOverrides:this._i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,r,i)=>{this._setAttributeData(t,r);const s=this.loadedGraphics.getNode(t);if(a(i)){const t=this.loadedGraphics.get(i.attributes[e]);a(t)&&this.processor.graphicsCore.recreateGraphics([t])}else a(s)&&this.processor.graphicsCore.recreateGraphics(s.graphics)},clearMemCache:()=>{}}}get performanceInfo(){const e={displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:this.maximumNumberOfFeatures,totalNumberOfFeatures:-1,nodes:this.loadedGraphics.nodeCount,core:this.processor.graphicsCore.performanceInfo};return this._controller&&this._controller.updateStats(e),e}get test(){return{controller:this._controller,numNodes:this.loadedGraphics.nodeCount,loadedGraphics:this.loadedGraphics}}};e([h()],Y.prototype,"processor",void 0),e([h({type:I})],Y.prototype,"filter",void 0),e([h()],Y.prototype,"loadedGraphics",void 0),e([h()],Y.prototype,"i3slayer",null),e([h()],Y.prototype,"_controller",void 0),e([h()],Y.prototype,"updating",void 0),e([h()],Y.prototype,"suspended",void 0),e([h()],Y.prototype,"holeFilling",void 0),e([h(T)],Y.prototype,"updatingProgress",void 0),e([h()],Y.prototype,"updatingProgressValue",null),e([h(K.requiredFields)],Y.prototype,"requiredFields",null),e([h(K.availableFields)],Y.prototype,"availableFields",void 0),e([h()],Y.prototype,"_fieldsHelper",void 0),e([h({type:Number})],Y.prototype,"maximumNumberOfFeatures",null),e([h({readOnly:!0})],Y.prototype,"maximumNumberOfFeaturesExceeded",null),e([h()],Y.prototype,"_excludeObjectIdsSorted",null),e([h({readOnly:!0})],Y.prototype,"lodFactor",null),e([h({readOnly:!0})],Y.prototype,"hasM",null),e([h({readOnly:!0})],Y.prototype,"hasZ",null),Y=e([u("esri.views.3d.layers.SceneLayerGraphicsView3D")],Y);const $=Y;function J(e){return"pointData"in e}function X(e){return"geometryBuffer"in e&&null!==e.geometryBuffer}function ee(e,t,r){const i=t.attributeInfo;if(o(i)||o(i.loadedAttributes)||o(i.attributeData))return!1;let s=!1;for(const{name:o}of i.loadedAttributes)if(i.attributeData[o]){const t=V(i.attributeData[o],r);t!==e.attributes[o]&&(e.attributes[o]=t,s=!0)}return s}function te(e){const t=e.attributeInfo,r=e.node.index;if(!(o(t)||o(t.loadedAttributes)||o(t.attributeData)))for(let i=0;i<e.graphics.length;i++){const s=e.graphics[i];if(s.nodeIndex===r){s.attributes||(s.attributes={});for(const{name:e}of t.loadedAttributes)t.attributeData[e]&&(s.attributes[e]=V(t.attributeData[e],i))}}}function re(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,null!=e.zmin&&null!=e.zmax&&(e.zmin-=t,e.zmax+=t),null!=e.mmin&&null!=e.mmax&&(e.mmin-=t,e.mmax+=t),e}const ie={2:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0]}}},3:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0,0]}}}},se=p(),oe={graphic:null,property:null,oldValue:null,newValue:null};export{$ as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{binaryIndexOf as r}from"../../../core/arrayUtils.js";import i from"../../../core/Logger.js";import{destroyMaybe as s,isNone as o,isSome as a,unwrap as n}from"../../../core/maybe.js";import{initial as d,watch as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{s as c}from"../../../chunks/vec3.js";import{c as p}from"../../../chunks/vec3f64.js";import{projectBuffer as g,projectVectorToVector as m}from"../../../geometry/projection.js";import{extentContainsCoords3D as y}from"../../../geometry/support/contains.js";import{getGeometryZScaler as f}from"../../../geometry/support/zscale.js";import{fallbackObjectIDAttribute as _}from"../../../layers/LayerConstants.js";import{makeDehydratedPoint as b,estimateSize as v}from"../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as x}from"../../../layers/graphics/hydratedFeatures.js";import E from"../../../layers/graphics/controllers/I3SOnDemandController.js";import I from"../../../layers/support/FeatureFilter.js";import w from"../../../rest/support/Query.js";import{I3SPointsWorkerHandle as N}from"./I3SPointsWorkerHandle.js";import{LayerView3D as C}from"./LayerView3D.js";import O from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as D}from"./graphics/QueryEngine.js";import{createInteractiveEditSession as F,processAttributeEdits as j}from"./i3s/attributeEditing.js";import{I3SGraphicsMap as S}from"./i3s/I3SGraphicsMap.js";import{I3SOverrides as G}from"./i3s/I3SOverrides.js";import{checkRecyclable as A,checkSpatialReferences as L,containsDraco as P,whenGraphicAttributes as V,getCachedAttributeValue as R}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as M}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as H}from"./support/fieldProperties.js";import{PopupSceneLayerView as q}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as U}from"./support/SceneLayerViewRequiredFields.js";import Q from"../support/debugFlags.js";import{compute as T}from"../support/orientedBoundingBox.js";import{updatingProgress as B}from"../support/updatingProperties.js";import{Attribute as k}from"../webgl-engine/lib/Attribute.js";import{newDoubleArray as z}from"../webgl-engine/lib/DoubleArray.js";import{UpdatePolicy as W}from"../webgl-engine/lib/UpdatePolicy.js";import Z from"../../layers/SceneLayerView.js";import{TaskPriority as K}from"../../support/Scheduler.js";const Y=H();let $=class extends(M(q(C(Z)))){constructor(){super(...arguments),this.type="scene-layer-graphics-3d",this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this.loadedGraphics=new S(((e,t,r)=>te(e,t,r)),(e=>this.processor.graphicsCore.recreateGraphics(e))),this.holeFilling="always",this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}tryRecycleWith(e,t){return e.url===this.layer.url&&this._i3sOverrides.isEmpty?e.load(t).then((()=>{A(this.layer,e,this._i3sOverrides),this.layer=e,this._i3sOverrides.destroy();const t=this.view.resourceController?.memoryController;this._i3sOverrides=new G({view:this.view,layer:e,memoryController:t}),s(this._queryEngine),this._setupQueryEngine(),this.processor.resetObjectStates()})):null}initialize(){this.addResolvingPromise(this.layer.indexInfo);const e=this.view.resourceController?.memoryController;this._i3sOverrides=new G({view:this.view,layer:this.layer,memoryController:e}),L(this.layer,this.view.spatialReference,this.view.viewingMode),this._fieldsHelper=new U({layerView:this}),this.updatingHandles.add((()=>this.layer.rangeInfos),(e=>this._rangeInfosChanged(e)),d),this.updatingHandles.add((()=>this.layer.renderer),((e,t)=>this._rendererChange(e,t))),this.updatingHandles.add((()=>[this.parsedDefinitionExpression,this._excludeObjectIdsSorted]),(()=>this._filterChange())),this.handles.add(l((()=>Q.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&Q.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||!this._treeDebugger||Q.I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)}),d)),this._set("processor",new O({owner:this,preferredUpdatePolicy:W.ASYNC,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,setUidToIdOnAdd:!1,dataExtent:this.layer.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),this.processor.elevationAlignment?.events.on("invalidate-elevation",(e=>this._controller.updateElevationChanged(e.extent,e.spatialReference))),this.supportsHeightUnitConversion&&(this._verticalScale=f("point",this.layer.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.initializePromise),this._memCache=this.view.resourceController.memoryController.newCache(this.uid),this._controller=new E({layerView:this,scaleVisibilityEnabled:!1}),P(this.layer.geometryDefinitions)&&(this._worker=new N((e=>this.view.resourceController.immediate.schedule(e)))),this.handles.add(this.layer.on("apply-edits",(e=>this.updatingHandles.addPromise(e.result)))),this.handles.add(this.layer.on("edits",(e=>this._handleEdits(e)))),this.when((()=>{this._setupQueryEngine(),this.updatingHandles.add((()=>this.maximumNumberOfFeatures),(e=>this._controller.featureTarget=e),d),this.updatingHandles.add((()=>this.suspended),(e=>{e&&this._removeAllNodeData()}))}))}destroy(){this._treeDebugger=s(this._treeDebugger),this._i3sOverrides=s(this._i3sOverrides),this._set("processor",s(this.processor)),this._controller=s(this._controller),this._queryEngine=s(this._queryEngine),this._worker=s(this._worker),this._memCache=s(this._memCache),this.loadedGraphics.clear(),this._fieldsHelper=s(this._fieldsHelper)}get i3slayer(){return this.layer}get updatingProgressValue(){return this._controller?.updatingProgress??1}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get maximumNumberOfFeatures(){const e=this.processor?.graphicsCore?.displayFeatureLimit;return e?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){null!=e?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){return!this.suspended&&(!!this._controller?.useMaximumNumberOfFeatures&&!this._controller.leavesReached)}get _excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds;return e.length?e.toArray().sort(((e,t)=>e-t)):null}get lodFactor(){return"Labels"===this.layer.semantic?1:this.view.qualitySettings.sceneService.point.lodFactor}get hasM(){return!1}get hasZ(){return!0}async whenGraphicAttributes(e,t){return V(this.layer,e,this._getObjectIdField(),t,(()=>[...this.loadedGraphics.nodes()]))}getHit(e){if(!this.loadedGraphics)return null;const t=x(this.loadedGraphics.find((t=>t.uid===e)),this.layer),r=this._getObjectIdField();return t&&t.attributes&&t.attributes[r]?(t.layer=this.layer,t.sourceLayer=this.layer,{type:"graphic",graphic:t,layer:t.layer}):null}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}isUpdating(){return!!(this._controller?.updating||this.processor?.updating||this._fieldsHelper?.updating||this.layerFilterUpdating)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return F(this._attributeEditingContext,e)}async _decompressBinaryPointData(e,t){const r={geometryBuffer:e.geometryBuffer};o(this._worker)&&(this._worker=new N((e=>this.view.resourceController.immediate.schedule(e))));const i=await this._worker.invoke(r,t);if(o(i))throw new Error("Failed to decompress Draco point data");return{positionData:i.positions,featureIds:i.featureIds}}async addNode(e,t,r){if(!ee(t)&&!X(t))throw new Error;if(this.loadedGraphics.hasNode(e.index))return void i.getLogger(this.declaredClass).error("I3S node "+e.id+" already added");const s=a(this.layer.fullExtent)?ie(this.layer.fullExtent.clone(),.5):null,o=[],{featureIds:n,pointPositions:d}=ee(t)?await this._extractBinaryPointPositions(e,t,r):this._extractLegacyPointPositions(t);this._validatePositions(e,n,d,s,o);const l=this._controller.crsVertex,h=this.view.spatialReference;g(d,l,0,d,h,0,n.length);const u=ee(t)?e.level:0,c={graphics:this._createGraphics(n,d,e.index,u),featureIds:n,attributeInfo:t.attributeDataInfo,node:e};if(await this._i3sOverrides.apply(c.featureIds,t.attributeDataInfo,r),e.numFeatures=c.graphics.length,this._updateNodeMemory(e),re(c),o.length>0&&(this._computeObb(e,o,l),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e))return void this._cacheNodeData(c);if(a(this._verticalScale))for(const i of c.graphics)this._verticalScale(i.geometry);const p=this.view._stage.renderView.objectAndLayerIdRenderHelper;if(a(p))for(let i=0;i<c.featureIds.length;i++){const e=c.featureIds[i];p.setUidToObjectAndLayerId(e,c.graphics[i].uid,this.layer.id,this.layer.uid,this.layer.popupEnabled,c.node.resources.attributes,i)}this.loadedGraphics.addNode(e.index,c),this._controller.updateLoadStatus(e.index,!0),this._filterNode(c),this._treeDebugger&&this._treeDebugger.update()}_computeObb(e,t,r){const i=this._controller.crsIndex,s=i.isGeographic?this.view.renderSpatialReference:i;g(t,r,0,t,s,0,t.length/3),e.serviceObb=T(new k(t,3)),i.isGeographic&&m(e.serviceObb.center,s,e.serviceObb.center,i)}isNodeLoaded(e){return this.loadedGraphics.hasNode(e)}isNodeReloading(){return!1}updateNodeState(){}async _extractBinaryPointPositions(e,t,r){const i=await this._decompressBinaryPointData(t,r),s=i.positionData,o=3,n=s.length/o,d=z(3*n),l=a(e.serviceObb)?e.serviceObb.center:[0,0,0],h=Math.abs(l[2])*2**-20;for(let a=0;a<n;a++){const e=a*o;d[e+0]=s[e+0]+l[0],d[e+1]=s[e+1]+l[1],d[e+2]=s[e+2]+l[2],Math.abs(d[e+2])<h&&(d[e+2]=0)}return{featureIds:i.featureIds?Array.from(i.featureIds):[],pointPositions:d}}_extractLegacyPointPositions(e){const t=e.pointData.length,r=z(3*t),i=new Array;for(let s=0;s<t;s++){const t=e.pointData[s],o=t.featureDataPosition,a=o.length,n=t.geometries?.[0]??se[a],d=t.featureIds[0];if("Embedded"!==n.type||"points"!==n.params.type||a<2||a>3)continue;const l=n.params.vertexAttributes?.position??[0,0,0],h=3*i.length;r[h+0]=o[0]+l[0],r[h+1]=o[1]+l[1],r[h+2]=3===a?o[2]+l[2]:NaN,i.push(d)}return{featureIds:i,pointPositions:r}}_validatePositions(e,t,r,s,n){if(o(s)&&e.serviceObb)return;const d=t.length,l=3;for(let o=0;o<d;o++){const t=o*l;c(oe,r[t],r[t+1],r[t+2]),a(s)&&!y(s,oe)&&(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&i.getLogger(this.declaredClass).error("Service Error: Coordinates outside of layer extent"),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&i.getLogger(this.declaredClass).error("Maximum number of errors reached. Further errors are ignored."),this._coordinatesOutsideExtentErrors++),e.serviceObb||n.push(oe[0],oe[1],oe[2])}}_createGraphics(e,r,i,s){const o=e.length,d=3,l=this._getObjectIdField(),h=this.processor.graphicsCore,u=new Array,c=this.view.spatialReference;for(let p=0;p<o;p++){const o=e[p],g={};null!=o&&(g[l]=o);const m=o??t.generateUID(),y=p*d,f=isNaN(r[y+2])?void 0:r[y+2],_=b(r[y],r[y+1],f,c),v=this.loadedGraphics.get(m);if(a(v))(null==v.level||v.level<s)&&(ae.property="geometry",ae.graphic=v,ae.oldValue=n(v.geometry),ae.newValue=_,v.geometry=_,v.level=s,h.graphicUpdateHandler(ae)),u.push(v);else{const e=t.generateUID();u.push({objectId:m,uid:e,geometry:_,attributes:g,visible:!0,nodeIndex:i,level:s})}}return u}_updateNodeMemory(e){e.memory=4096+(a(e.numFeatures)?e.numFeatures*this.processor.graphicsCore.usedMemoryPerGraphic:0)}_cacheNodeData(e){const t=e.graphics.reduce(((e,t)=>v(t)+e),512+8*e.featureIds.length+1024);this._memCache.put(this._getMemCacheKey(e.node),e,t)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this.loadedGraphics.forEachNode(((e,t)=>{if(e){const t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}this._controller.updateLoadStatus(t,!1)})),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this.loadedGraphics.getNode(e);return o(t)?null:(this._controller.updateLoadStatus(e,!1),this.loadedGraphics.removeNode(e),this._treeDebugger&&this._treeDebugger.update(),t)}async loadCachedNodeData(e){return this._memCache?.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,t,r,s){this.loadedGraphics.hasNode(e.index)?i.getLogger(this.declaredClass).error("I3S node "+e.id+" already added"):(await this._i3sOverrides.apply(t.featureIds,r,s),this.loadedGraphics.addNode(e.index,t),this._controller.updateLoadStatus(e.index,!0),this._updateNodeMemory(e),t.attributeInfo=r,this._attributeValuesChanged(t),this._filterNode(t),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){const e=[];return this.loadedGraphics.forEachNode((t=>e.push(t.node.id))),e.sort()}getVisibleNodes(){const e=new Array;return this.loadedGraphics.forEachNode((t=>e.push(t.node))),e}getLoadedNodeIndices(e){this.loadedGraphics.forEachNode(((t,r)=>e.push(r)))}getLoadedAttributes(e){const t=this.loadedGraphics.getNode(e);if(a(t)&&a(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this.loadedGraphics.getNode(e);if(a(t)&&a(t.attributeInfo))return t.attributeInfo.attributeData}_setAttributeData(e,t){const r=this.loadedGraphics.getNode(e);o(r)||o(r.attributeInfo)||(r.attributeInfo.attributeData=t,this._attributeValuesChanged(r))}async updateAttributes(e,t,r){const i=this.loadedGraphics.getNode(e);o(i)||(await this._i3sOverrides.apply(i.featureIds,t,r),i.attributeInfo=t,this._attributeValuesChanged(i))}_attributeValuesChanged(e){if(re(e),this._filterNode(e),this.processor.graphicsCore.labelsEnabled){const t=e.graphics.map((e=>e.uid));this.processor.graphicsCore.updateLabelingInfo(t)}}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||_}async _rendererChange(e,t){const{layer:{fieldsIndex:r}}=this,i=new Set;let s,o;e?(await e.collectRequiredFields(i,r),s=Array.from(i).sort()):s=[],i.clear(),t?(await t.collectRequiredFields(i,r),o=Array.from(i).sort()):o=[],s.length===o.length&&s.every(((e,t)=>s[t]===o[t]))||this._reloadAllNodes()}_rangeInfosChanged(e){null!=e&&e.length>0&&i.getLogger(this.declaredClass).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}_filterChange(){this.loadedGraphics.forEachNode((e=>this._filterNode(e)))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){const t=this.parsedDefinitionExpression,i=this._excludeObjectIdsSorted,s=this._getObjectIdField();for(const a of e.graphics){const e=a.visible,n=!t||this._evaluateClause(t,a),d=o(i)||r(i,a.attributes[s])<0;a.visible=n&&d,e!==a.visible&&(ae.graphic=a,ae.property="visible",ae.oldValue=e,ae.newValue=a.visible,this.processor.graphicsCore.graphicUpdateHandler(ae))}}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return a(this.filter)?this.filter.createQuery(e):new w(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(o(e)?this.createQuery():w.from(e))}_setupQueryEngine(){const e=()=>this.processor.featureStore;this._queryEngine=new D({context:{spatialReference:this.view.spatialReference,layer:this.layer,scheduler:this.view.resourceController.scheduler,get featureStore(){return e()},hasZ:this.hasZ,hasM:this.hasM},priority:K.FEATURE_QUERY_ENGINE})}getUsedMemory(){return this.processor?.graphicsCore?.usedMemory??0}getUnloadedMemory(){return.8*((this._controller?.unloadedMemoryEstimate??0)+(this.processor?.graphicsCore?.unprocessedMemoryEstimate??0))}ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}_handleEdits(e){j(this._attributeEditingContext,e)}get _attributeEditingContext(){const e=this._getObjectIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,forEachNode:e=>this.loadedGraphics.forEachNode((t=>e(t.node,t.featureIds))),attributeStorageInfo:this.i3slayer.attributeStorageInfo??[],i3sOverrides:this._i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,r,i)=>{this._setAttributeData(t,r);const s=this.loadedGraphics.getNode(t);if(a(i)){const t=this.loadedGraphics.get(i.attributes[e]);a(t)&&this.processor.graphicsCore.recreateGraphics([t])}else a(s)&&this.processor.graphicsCore.recreateGraphics(s.graphics)},clearMemCache:()=>{}}}get performanceInfo(){const e={displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:this.maximumNumberOfFeatures,totalNumberOfFeatures:-1,nodes:this.loadedGraphics.nodeCount,core:this.processor.graphicsCore.performanceInfo};return this._controller&&this._controller.updateStats(e),e}get test(){return{controller:this._controller,numNodes:this.loadedGraphics.nodeCount,loadedGraphics:this.loadedGraphics}}};e([h()],$.prototype,"processor",void 0),e([h({type:I})],$.prototype,"filter",void 0),e([h()],$.prototype,"loadedGraphics",void 0),e([h()],$.prototype,"i3slayer",null),e([h()],$.prototype,"_controller",void 0),e([h()],$.prototype,"updating",void 0),e([h()],$.prototype,"suspended",void 0),e([h()],$.prototype,"holeFilling",void 0),e([h(B)],$.prototype,"updatingProgress",void 0),e([h()],$.prototype,"updatingProgressValue",null),e([h(Y.requiredFields)],$.prototype,"requiredFields",null),e([h(Y.availableFields)],$.prototype,"availableFields",void 0),e([h()],$.prototype,"_fieldsHelper",void 0),e([h({type:Number})],$.prototype,"maximumNumberOfFeatures",null),e([h({readOnly:!0})],$.prototype,"maximumNumberOfFeaturesExceeded",null),e([h()],$.prototype,"_excludeObjectIdsSorted",null),e([h({readOnly:!0})],$.prototype,"lodFactor",null),e([h({readOnly:!0})],$.prototype,"hasM",null),e([h({readOnly:!0})],$.prototype,"hasZ",null),$=e([u("esri.views.3d.layers.SceneLayerGraphicsView3D")],$);const J=$;function X(e){return"pointData"in e}function ee(e){return"geometryBuffer"in e&&null!==e.geometryBuffer}function te(e,t,r){const i=t.attributeInfo;if(o(i)||o(i.loadedAttributes)||o(i.attributeData))return!1;let s=!1;for(const{name:o}of i.loadedAttributes)if(i.attributeData[o]){const t=R(i.attributeData[o],r);t!==e.attributes[o]&&(e.attributes[o]=t,s=!0)}return s}function re(e){const t=e.attributeInfo,r=e.node.index;if(!(o(t)||o(t.loadedAttributes)||o(t.attributeData)))for(let i=0;i<e.graphics.length;i++){const s=e.graphics[i];if(s.nodeIndex===r){s.attributes||(s.attributes={});for(const{name:e}of t.loadedAttributes)t.attributeData[e]&&(s.attributes[e]=R(t.attributeData[e],i))}}}function ie(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,null!=e.zmin&&null!=e.zmax&&(e.zmin-=t,e.zmax+=t),null!=e.mmin&&null!=e.mmax&&(e.mmin-=t,e.mmax+=t),e}const se={2:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0]}}},3:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0,0]}}}},oe=p(),ae={graphic:null,property:null,oldValue:null,newValue:null};export{J as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Logger.js";import{isNone as i,isSome as s,destroyMaybe as o}from"../../../core/maybe.js";import{initial as l}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{WhereClause as u}from"../../../core/sql/WhereClause.js";import d from"../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as h}from"../../../layers/support/floorFilterUtils.js";import p from"../../../rest/support/Query.js";import{sceneLayerEditingEnabled as c}from"../../../support/featureFlags.js";import{I3SMeshView3D as y}from"./I3SMeshView3D.js";import{ForAllFeaturesVisibilityMode as g}from"./II3SMeshView3D.js";import{LayerView3D as f}from"./LayerView3D.js";import{createInteractiveEditSession as m,processGeometryEdits as _,processAttributeEdits as F}from"./i3s/attributeEditing.js";import{createGetFeatureExtent as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Logger.js";import{isNone as i,isSome as s,destroyMaybe as o}from"../../../core/maybe.js";import{initial as l}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{WhereClause as u}from"../../../core/sql/WhereClause.js";import d from"../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as h}from"../../../layers/support/floorFilterUtils.js";import p from"../../../rest/support/Query.js";import{sceneLayerEditingEnabled as c}from"../../../support/featureFlags.js";import{I3SMeshView3D as y}from"./I3SMeshView3D.js";import{ForAllFeaturesVisibilityMode as g}from"./II3SMeshView3D.js";import{LayerView3D as f}from"./LayerView3D.js";import{createInteractiveEditSession as m,processGeometryEdits as _,processAttributeEdits as F}from"./i3s/attributeEditing.js";import{createGetFeatureExtent as v}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as j}from"./i3s/I3SMeshViewFilter.js";import{NodeFilterImpact as w}from"./i3s/I3SNode.js";import{I3SOverrides as I}from"./i3s/I3SOverrides.js";import{I3SQueryEngine as S}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as b}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as E}from"./i3s/I3SQueryFeatureStore.js";import{checkRecyclable as C,getIndexCrs as x,objectIdFilter as Q}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as O}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as q}from"./support/fieldProperties.js";import{PopupSceneLayerView as D}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as R}from"./support/SceneLayerViewRequiredFields.js";import{updatingProgress as H}from"../support/updatingProperties.js";import A from"../../layers/SceneLayerView.js";import{TaskPriority as L}from"../../support/Scheduler.js";const V=q();let U=class extends(y(O(D(f(A))))){constructor(){super(...arguments),this.type="scene-layer-3d",this.progressiveLoadFactor=1,this._elevationContext="scene",this._isIntegratedMesh=!1,this._supportsLabeling=!0,this._interactiveEditingSessions=new Map,this._queryEngine=null}get i3slayer(){return this.layer}tryRecycleWith(e,t){return e.url===this.layer.url&&this.i3sOverrides.isEmpty?e.load(t).then((()=>{C(this.layer,e,this.i3sOverrides),this.layer=e,this.i3sOverrides.destroy();const t=this.view.resourceController?.memoryController;this.i3sOverrides=new I({view:this.view,layer:e,memoryController:t}),this.resetHighlights()})):null}get layerPopupEnabled(){return this.layer.popupEnabled}get filter(){return this._get("filter")}set filter(e){this._set("filter",j.checkSupport(e)?e:null)}get viewFilter(){const e=this.filter,t=this.layerFilter;if(i(e)&&i(t))return null;const r=this._get("viewFilter");return i(r)?new j({layerFilter:t,viewFilter:e,layerFieldsIndex:this.layer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,t)=>this.addSqlFilter(e,t,this.logError)}):(r.viewFilter=e,r.layerFilter=t,r)}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get _floorFilterClause(){const e=h(this);return s(e)?u.create(e,this.layer.fieldsIndex):null}get _excludeObjectIdsSorted(){let e=this.layer.excludeObjectIds.toArray();return c()&&this.i3sOverrides.geometryChangedObjectIds.length>0&&(e=e.concat(this.i3sOverrides.geometryChangedObjectIds)),e.length?e.sort(((e,t)=>e-t)):null}get _objectQualitySettings(){return this.view?.qualitySettings?.sceneService?.object}get lodFactor(){return this._objectQualitySettings?.lodFactor??1}get lodCrossfadeinDuration(){return this._objectQualitySettings.lodCrossfadeinDuration??0}get lodCrossfadeoutDuration(){return this._objectQualitySettings.lodCrossfadeoutDuration??0}get lodCrossfadeUncoveredDuration(){return this._objectQualitySettings.lodCrossfadeUncoveredDuration??0}get updatingProgressValue(){return this._controller?.updatingProgress??0}initialize(){this._fieldsHelper=new R({layerView:this}),this.updatingHandles.add((()=>this.layer.rangeInfos),(e=>this._rangeInfosChanged(e)),l),this.updatingHandles.add((()=>this.layer.renderer),(e=>this.updatingHandles.addPromise(this._rendererChange(e))),l);const e=()=>this._filterChange();this.updatingHandles.add((()=>this.parsedDefinitionExpression),e),this.updatingHandles.add((()=>this.filter),e),this.updatingHandles.add((()=>this._floorFilterClause),e),this.updatingHandles.add((()=>this._excludeObjectIdsSorted),e),this.updatingHandles.add((()=>s(this.viewFilter)?this.viewFilter.sortedObjectIds:null),e),this.updatingHandles.add((()=>s(this.viewFilter)?this.viewFilter.parsedWhereClause:null),e),this.updatingHandles.add((()=>[s(this.viewFilter)?this.viewFilter.parsedGeometry:null,s(this.filter)?this.filter.spatialRelationship:null,s(this.layer.filter)?this.layer.filter.spatialRelationship:null]),(()=>this._geometryFilterChange())),this.handles.add(this.layer.on("apply-edits",(e=>this.updatingHandles.addPromise(e.result)))),this.handles.add(this.layer.on("edits",(e=>this._handleEdits(e))))}destroy(){this._fieldsHelper=o(this._fieldsHelper)}_rangeInfosChanged(e){null!=e&&e.length>0&&r.getLogger(this.declaredClass).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return s(this.filter)?this.filter.createQuery(e):new p(e)}queryExtent(e,t){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),t?.signal)}queryFeatures(e,t){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),t?.signal).then((e=>{if(!e?.features)return e;const t=this.layer;for(const r of e.features)r.layer=t,r.sourceLayer=t;return e}))}queryObjectIds(e,t){return this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),t?.signal)}_ensureQueryEngine(){return this._queryEngine||(this._queryEngine=this._createQueryEngine()),this._queryEngine}_createQueryEngine(){const e=v(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new S({layerView:this,priority:L.FEATURE_QUERY_ENGINE,spatialIndex:new E({featureAdapter:new b({objectIdField:this.layer.objectIdField,attributeStorageInfo:this.layer.attributeStorageInfo??[],getFeatureExtent:e}),forAllFeatures:(e,t)=>this._forAllFeatures(((t,r,i)=>e({id:t,index:r,meta:i})),t,g.ALL_IN_CLIPPING_AREA),getFeatureExtent:e,sourceSpatialReference:x(this.layer),viewSpatialReference:this.view.spatialReference})})}highlight(e){const t=this._highlights;if(e instanceof p){const{set:r,handle:i}=t.acquireSet();return this.queryObjectIds(e).then((e=>t.setFeatureIds(r,e))),i}return super.highlight(e)}createInteractiveEditSession(e){return m(this._attributeEditingContext,e)}_createLayerGraphic(e){const r=new t(null,null,e);return r.layer=this.layer,r.sourceLayer=this.layer,r}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}getFilters(){const e=super.getFilters(),t=this._excludeObjectIdsSorted;return s(t)&&e.push((e=>Q(t,!1,e))),this._floorFilterClause&&this.addSqlFilter(e,this._floorFilterClause,this.logError),this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),s(this.viewFilter)&&this.viewFilter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}isUpdating(){return super.isUpdating()||this.layerFilterUpdating||s(this.viewFilter)&&this.viewFilter.updating||s(this.i3sOverrides)&&this.i3sOverrides.updating}_ensureQuery(e){return this._addDefinitionExpressionToQuery(i(e)?this.createQuery():p.from(e))}get _attributeEditingContext(){return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:this._getObjectIdField(),forEachNode:e=>this._forAllNodes((t=>s(t)?e(t.node,t.featureIds):null)),attributeStorageInfo:this.i3slayer.attributeStorageInfo??[],i3sOverrides:this.i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(e,t)=>this.setAttributeData(e,t),clearMemCache:()=>this.clearMemCache()}}_handleEdits(e){c()&&_(this._attributeEditingContext,e),F(this._attributeEditingContext,e)}get hasGeometryFilter(){const e=this.viewFilter;return s(e)&&s(e.parsedGeometry)}computeNodeFiltering(e){const t=this.viewFilter;return i(t)||!this.view.spatialReference||t.isMBSGeometryVisible(e,this.view.spatialReference,this._controller.crsIndex)?w.Unmodified:w.Culled}};e([n()],U.prototype,"i3slayer",null),e([n(H)],U.prototype,"updatingProgress",void 0),e([n({type:d})],U.prototype,"filter",null),e([n({readOnly:!0})],U.prototype,"viewFilter",null),e([n(V.requiredFields)],U.prototype,"requiredFields",null),e([n(V.availableFields)],U.prototype,"availableFields",void 0),e([n()],U.prototype,"_fieldsHelper",void 0),e([n()],U.prototype,"_floorFilterClause",null),e([n()],U.prototype,"_excludeObjectIdsSorted",null),e([n()],U.prototype,"_objectQualitySettings",null),e([n()],U.prototype,"lodFactor",null),e([n()],U.prototype,"updatingProgressValue",null),U=e([a("esri.views.3d.layers.SceneLayerView3D")],U);const P=U;export{P as default};
|