@arcgis/core 5.0.0-next.30 → 5.0.0-next.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Basemap.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{406d270ae2b3cf9e1f1b.js → 05e55118dc0023d500fc.js} +1 -1
- package/assets/esri/core/workers/chunks/{93fe46be3c7fe34b5361.js → 1432e789aa4cba627337.js} +1 -1
- package/assets/esri/core/workers/chunks/{6e9d731cb20307b83ab0.js → 1e55f152b60145f33b61.js} +1 -1
- package/assets/esri/core/workers/chunks/444026d1938c1078ca97.js +1 -0
- package/assets/esri/core/workers/chunks/{a425ffec91d07bbfeb80.js → 565358ea8d1bdc4d1ebc.js} +1 -1
- package/assets/esri/core/workers/chunks/{d769c1b18e2710e0388b.js → a6324f5f560ffadc6e5d.js} +1 -1
- package/assets/esri/core/workers/chunks/{a091623bbfb3d771c8d8.js → d8db2c51b2fb42f37b2a.js} +1 -1
- package/assets/esri/core/workers/chunks/{984bb0943d07c86b7e77.js → ded3ef385d5a3a2ec8ca.js} +1 -1
- package/config.js +1 -1
- package/core/Message.js +1 -1
- package/geometry/Circle.js +1 -1
- package/geometry/Extent.js +1 -1
- package/geometry/geodesicUtils.js +5 -0
- package/geometry/support/geodesicUtils.js +1 -1
- package/interfaces.d.ts +427 -187
- package/kernel.js +1 -1
- package/layers/graphics/OptimizedGeometry.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/knowledgeGraph/SessionMemoryStorage.js +1 -1
- package/layers/support/BuildingFilterBlock.js +1 -1
- package/package.json +2 -2
- package/rest/support/QueryMixin.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/analysis/AreaMeasurement/AreaMeasurementController.js +1 -1
- package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementController.js +1 -1
- package/views/2d/grid/gridUtils.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/OGCFeatureLayerView2D.js +1 -1
- package/views/2d/layers/StreamLayerView2D.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/environment/SceneViewEnvironment.js +1 -1
- package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
- package/views/3d/layers/DimensionLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/ImageryLayerView3D.js +1 -1
- package/views/3d/layers/LineOfSightLayerView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/OGCFeatureLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/StreamLayerView3D.js +1 -1
- package/views/3d/layers/ViewshedLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
- package/views/interactive/sketch/constraintUtils.js +1 -1
- package/views/interactive/sketch/constraints.js +1 -1
- package/views/layers/DimensionLayerView.js +1 -1
- package/views/layers/DimensionLayerViewMixin.js +5 -0
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/layers/FeatureLayerViewMixin.d.ts +2 -2
- package/views/layers/FeatureLayerViewMixin.js +5 -0
- package/views/layers/ImageryLayerView.js +1 -1
- package/views/layers/ImageryLayerViewMixin.js +5 -0
- package/views/layers/LineOfSightLayerView.js +1 -1
- package/views/layers/LineOfSightLayerViewMixin.js +5 -0
- package/views/layers/MediaLayerView.js +1 -1
- package/views/layers/MediaLayerViewMixin.js +5 -0
- package/views/layers/OGCFeatureLayerView.js +1 -1
- package/views/layers/PointCloudLayerView.js +1 -1
- package/views/layers/StreamLayerView.js +1 -1
- package/views/layers/ViewshedLayerView.js +1 -1
- package/views/layers/ViewshedLayerViewMixin.js +5 -0
- package/views/support/LayerLayerViewInfo.js +1 -1
- package/views/support/PromiseQueue.js +1 -1
- package/views/support/angularMeasurementUtils.js +1 -1
- package/views/support/drapedUtils.js +1 -1
- package/views/support/geodesicAreaMeasurementUtils.js +1 -1
- package/views/support/geodesicLengthMeasurementUtils.js +1 -1
- package/views/support/geodesicMeasurementUtils.js +1 -1
- package/webscene/Environment.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
- package/widgets/Attribution.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
- package/widgets/support/forms/expressions/FormExpressionArcadeExecutor.js +1 -1
- package/assets/esri/core/workers/chunks/b66e41d626a7d1b81d48.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import r from"../../../core/Error.js";import{handlesGroup as t,makeHandle as s}from"../../../core/handleUtils.js";import{watch as n}from"../../../core/reactiveUtils.js";import{property as i,subclass as o}from"../../../core/accessorSupport/decorators.js";import a from"../../../rest/support/FeatureSet.js";import{isNumber as l}from"../../../support/guards.js";import c from"./FeatureLayerView2D.js";import{handleNoEngineError as h}from"./support/handleNoEngineError.js";import{
|
|
5
|
+
import{__decorate as e}from"tslib";import r from"../../../core/Error.js";import{handlesGroup as t,makeHandle as s}from"../../../core/handleUtils.js";import{watch as n}from"../../../core/reactiveUtils.js";import{property as i,subclass as o}from"../../../core/accessorSupport/decorators.js";import a from"../../../rest/support/FeatureSet.js";import{isNumber as l}from"../../../support/guards.js";import c from"./FeatureLayerView2D.js";import{handleNoEngineError as h}from"./support/handleNoEngineError.js";import{StreamLayerViewMixin as u}from"../../layers/StreamLayerView.js";let p=class extends(u(c)){constructor(){super(...arguments),this.pipelineConnectionStatus="disconnected",this.pipelineErrorString=null}initialize(){this.addHandles([n(()=>this.layer.customParameters,async e=>{(await this.getWorker()).streamMessenger.updateCustomParameters(e)}),this.layer.on("send-message-to-socket",async e=>{(await this.getWorker()).streamMessenger.sendMessageToSocket(e)}),this.layer.on("send-message-to-client",async e=>{(await this.getWorker()).streamMessenger.sendMessageToClient(e),this._isUserPaused&&"type"in e&&"clear"===e.type&&this.incrementSourceRefreshVersion()}),n(()=>this.layer.purgeOptions,()=>this._update()),n(()=>this.suspended,this._onSuspendedChange.bind(this))],"constructor"),this._doResume()}destroy(){this._doPause()}get connectionError(){return this.pipelineErrorString?new r("stream-controller",this.pipelineErrorString):null}on(e,r){if(Array.isArray(e))return t(e.map(e=>this.on(e,r)));const n=["data-received","message-received"].includes(e);n&&this.getWorker().then(r=>r.streamMessenger.enableEvent(e,!0));const i=super.on(e,r),o=this;return s(()=>{i.remove(),n&&(o._workerProxy.closed||o.hasEventListener(e)||o.getWorker().then(r=>r.streamMessenger.enableEvent(e,!1)))})}async queryLatestObservations(e,t){if(!(this.layer.timeInfo?.endField||this.layer.timeInfo?.startField||this.layer.timeInfo?.trackIdField))throw new r("streamlayer-no-timeField","queryLatestObservation can only be used with services that define a TrackIdField");const s=await this.getWorker();return h(s.features.executeQueryForLatestObservations(this._cleanUpQuery(e),t).then(e=>{const r=a.fromJSON(e);return r.features.forEach(e=>{e.layer=this.layer,e.sourceLayer=this.layer,e.origin=this.layer.graphicOrigin}),r}),new a({features:[]}))}detach(){super.detach(),this.pipelineConnectionStatus="disconnected"}async queryObjectIds(e,r){return(await super.queryObjectIds(e,r)).filter(l)}get _streamConnectionStatus(){return this.pipelineConnectionStatus}_doPause(){null!=this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=null)}_doResume(){null==this._refreshInterval&&(this._refreshInterval=setInterval(()=>this.incrementSourceRefreshVersion(),this.layer.updateInterval))}_doDisconnect(){this.getWorker().then(e=>e.streamMessenger.disconnect()),this._doPause()}_doConnect(){this.getWorker().then(e=>e.streamMessenger.connect()),this.resume()}_doClear(){this.getWorker().then(e=>e.streamMessenger.clear()),null==this._refreshInterval&&this.incrementSourceRefreshVersion()}_createClientOptions(){const e=super._createClientOptions(),r=this;return{...e,get container(){return r.featureContainer},setProperty:e=>{this.set(e.propertyName,e.value)}}}};e([i()],p.prototype,"pipelineConnectionStatus",void 0),e([i()],p.prototype,"pipelineErrorString",void 0),e([i({readOnly:!0})],p.prototype,"connectionError",null),e([i({readOnly:!0})],p.prototype,"_streamConnectionStatus",null),p=e([o("esri.views.2d.layers.StreamLayerView2D")],p);const d=p;export{d as default};
|
package/views/3d/GroundView3D.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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{EventedMixin as t}from"../../core/Evented.js";import{when as r}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import{subclass as
|
|
5
|
+
import{__decorate as e}from"tslib";import{EventedMixin as t}from"../../core/Evented.js";import{when as r}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import a from"../GroundView.js";import{isIntegratedMeshLayerView as s}from"../support/layerViewUtils.js";let o=class extends(t(a)){constructor(){super(...arguments),this._integratedMeshElevationUpdateHandles=new Map}initialize(){super.initialize(),this.addHandles(r(()=>this._terrainSurface,e=>e.on("elevation-change",e=>this._elevationChange(e))));const e=this._integratedMeshElevationUpdateHandles;this.addHandles(this.view.allLayerViews.on("change",t=>{t.added.forEach(t=>{s(t)&&e.set(t,t.elevationProvider.on("elevation-change",e=>this._elevationChange(e)))}),t.removed.forEach(t=>{s(t)&&(e.get(t)?.remove(),e.delete(t))})}))}destroy(){this._integratedMeshElevationUpdateHandles.forEach(e=>e.remove()),this._integratedMeshElevationUpdateHandles.clear()}_elevationChange(e){this.emit("elevation-change",e)}get _integratedMeshGroundLayerView(){const e=this.ground?.integratedMeshGround;if(e)return this.view.basemapView?.groundLayerViews.find(t=>t.layer===e)}get _terrainSurface(){return this.view.basemapTerrain}get _usingTerrain(){return this._terrainSurface?.enabled??!1}get _usingIntegratedMesh(){return this._integratedMeshGroundLayerView?.visible??!1}get spatialReference(){return this._terrainSurface?.spatialReference}intersect(e,t,r,n){this._usingTerrain&&this._terrainSurface?.intersect(e,t,r,n);for(const i of this._integratedMeshElevationUpdateHandles.keys())i.intersect(e,t,r,n)}get updating(){return!this.suspended&&((this._source?.updating??!1)||this.layerViews.some(({updating:e})=>e))}getElevation(e,t,r,n){return this._elevationProvider?.getElevation(e,t,r,n)}getElevations(e,t,r){const{_elevationProvider:n}=this;if(n?.getElevations)return n.getElevations(e,t,r);for(let i=0;i<t;++i)r(i,null)}getSphereElevationBounds(e,t,r){return this._elevationProvider?.getSphereElevationBounds?.(e,t)}getRootElevationBounds(){return this._elevationProvider?.getRootElevationBounds?.()}get _elevationProvider(){return this._usingIntegratedMesh?this._integratedMeshGroundLayerView?.elevationProvider:this._terrainSurface}get elevationQueryCache(){return this._usingTerrain?this._terrainSurface?.elevationQueryCache:null}get extentAABR(){return this._terrainSurface?.extent}get suspended(){return this._source?.suspended??!1}get ready(){return this._source?.ready??!0}updateOverlayParameters(){this._terrainSurface?.updateOverlayParameters()}get _source(){return this._usingTerrain?this._terrainSurface:this._usingIntegratedMesh?this._integratedMeshGroundLayerView:null}requestRender(e){this.view.stage.renderView?.requestRender(e)}};e([n({readOnly:!0})],o.prototype,"_integratedMeshGroundLayerView",null),e([n({readOnly:!0})],o.prototype,"_terrainSurface",null),e([n({readOnly:!0})],o.prototype,"_usingTerrain",null),e([n({readOnly:!0})],o.prototype,"_usingIntegratedMesh",null),e([n({readOnly:!0})],o.prototype,"spatialReference",null),e([n({type:Boolean,readOnly:!0})],o.prototype,"updating",null),e([n({readOnly:!0})],o.prototype,"elevationQueryCache",null),e([n({readOnly:!0})],o.prototype,"extentAABR",null),e([n({readOnly:!0})],o.prototype,"suspended",null),e([n({readOnly:!0})],o.prototype,"ready",null),o=e([i("esri.views.3d.GroundView3D")],o);export{o as GroundView3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../Color.js";import{isSome as i}from"../../../core/arrayUtils.js";import{createTask as r}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{abortMaybe as s}from"../../../core/maybe.js";import{after as n,throwIfAborted as o}from"../../../core/promiseUtils.js";import{watch as a,syncAndInitial as l}from"../../../core/reactiveUtils.js";import{createScreenPointArray as c,createRenderScreenPointArray as d}from"../../../core/screenUtils.js";import{offsetDateUTC as u,convertTime as h}from"../../../core/timeUtils.js";import{property as p,subclass as _}from"../../../core/accessorSupport/decorators.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{AnalysisView3D as f}from"./AnalysisView3D.js";import{longitudeToTimezone as g}from"../support/earthUtils.js";import{computeDirectionsOverTime as y}from"../support/sunUtils.js";import{breadthFirstBinaryPartitioning as v}from"../../../widgets/support/traversalUtils.js";let w=class extends f{constructor(e){super(e),this.type="shadow-cast-view-3d",this.analysis=null,this._stopPreviewingTask=null,this._forcePreview=!1,this._autoRestoreForcePreviewEnabled=!0}initialize(){this.addHandles([a(()=>this._forcePreviewDependencies,()=>{s(this._stopPreviewingTask),this._forcePreview=!0,this._autoRestoreForcePreviewEnabled&&(this._stopPreviewingTask=r(async e=>{await n(U,e),o(e),this._forcePreview=!1}))},l),a(()=>({renderer:this._renderer,parameters:this._visualizationParameters}),({renderer:e,parameters:t})=>P(e,t),l),a(()=>({renderer:this._renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext}),({renderer:e,lightDirections:t,lightDirectionsContext:i})=>P(e,{lightDirections:t,lightDirectionsContext:i}),l),a(()=>({renderer:this._renderer,enabled:this.visible}),({renderer:e,enabled:t})=>P(e,{enabled:t}),l),a(()=>({renderer:this._renderer,previewing:this._previewing}),({renderer:e,previewing:t})=>P(e,{previewing:t}),l)])}destroy(){P(this._renderer,{enabled:!1})}get interactive(){return!1}set interactive(e){}get updating(){return!1}get visible(){return super.visible}set visible(e){super.visible=e}get _previewing(){const{view:e}=this;if(null==e?.allLayerViews)return!0;const{stationary:t,allLayerViews:i,graphicsView:r}=e;return this._forcePreview||!t||i.some(e=>C(e)&&e.updating)||!r?.suspended&&!!r?.updating}get _effectiveUtcOffset(){return this.analysis.utcOffset??this._utcOffsetAuto}get _utcOffsetAuto(){const e=this._referencePosition;return null!=e?g(e[0],!1):0}get _dateUTCOffset(){let e=this.analysis.date;return e=u(e,-e.getTimezoneOffset(),"minutes"),e=u(e,-this._effectiveUtcOffset,"hours"),e}get _startDateTimeUTC(){return u(this._dateUTCOffset,this.analysis.startTimeOfDay)}get _endDateTimeUTC(){return u(this._dateUTCOffset,this.analysis.endTimeOfDay)}get _referencePosition(){return this.view?.environmentManager?.referencePositionGeographic}get _durationInterval(){return this._duration>0?Math.floor(this._duration/(O-1)):O}get _interval(){const e=this._durationInterval;switch(this.analysis.mode){case"threshold":case"duration":return e;case"discrete":return this.analysis.discreteOptions.interval||e}}get _intervalContext(){const{mode:e,thresholdOptions:t}=this.analysis;return"threshold"===e&&t.contextEnabled?t.contextOptions.interval||this._durationInterval:-1}get _durationSampleCount(){return this._lightDirections.length}get _duration(){const{startTimeOfDay:e,endTimeOfDay:t}=this.analysis;return t-e}get _lightDirections(){return this._calculateLightDirections(this._interval)}get _lightDirectionsContext(){return this._calculateLightDirections(this._intervalContext)}_calculateLightDirections(e){const{view:t}=this;if(e<=0)return[];const i="global"===t.viewingMode?b:this._referencePosition;if(null==i)return[];const r=y(this._startDateTimeUTC,this._endDateTimeUTC,e,i,t.state.viewingMode,O),s=r.length;z.length=0;const n=v(0,s,z),o=new Array(s);for(let a=0;a<s;++a)o[a]=r[n[a]];return o}get _visualizationParameters(){if(!this.visible)return null;switch(this.analysis.mode){case"threshold":return this._thresholdVisualizationParameters;case"duration":return this._durationVisualizationParameters;case"discrete":return this._discreteVisualizationParameters}}get _thresholdVisualizationParameters(){const{threshold:e,color:i}=this.analysis.thresholdOptions,r=this._duration;return{visualization:2,thresholdColor:t.toUnitRGBA(i),threshold:r>0?e/this._duration:0,...this._thresholdDiscreteVisualizationParameters}}get _thresholdDiscreteVisualizationParameters(){const{thresholdOptions:e}=this.analysis;return e.contextEnabled?{visualization:3,gradientColor:t.toUnitRGBA(e.color)}:{}}get _durationVisualizationParameters(){const{color:e,mode:i}=this.analysis.durationOptions,r=this._duration,s=r>0&&"hourly"===i?T/r:0,n=t.toUnitRGBA(e);return 0===s?{...this._discreteVisualizationParameters,gradientColor:n}:{bandedGradientColor:n,visualization:1,bandSize:s}}get _discreteVisualizationParameters(){return{gradientColor:t.toUnitRGBA(this.analysis.discreteOptions.color),visualization:0}}get _forcePreviewDependencies(){const{view:e}=this,t=e.slice.plane,r=e.allLayerViews.toArray().filter(C),s=r.map(e=>e.layer).filter(i),n=r.map(e=>e.suspended),o=s.map(e=>e.visible),a=s.map(e=>e.opacity),l=!!e.graphicsView?.suspended,c=s.filter(e=>"definitionExpression"in e).map(e=>e.definitionExpression),d=r.filter(e=>"filter"in e).map(e=>e.filter);return{slicePlane:t,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:n,graphicsViewSuspended:l,layerVisibilities:o,layerOpacities:a,filters:d,definitionExpressions:c}}get _renderer(){return this.view?.stage?.renderer}get testData(){}async getDurationAtScreen(e){const{_renderer:t,_durationSampleCount:i}=this;if(null==t||0===i)return 0;const r=this.view.state.camera.screenToRender(c(e.x,e.y),d());return t.readAccumulatedShadow(r)*this._duration}};e([p({readOnly:!0,type:["shadow-cast-view-3d"]})],w.prototype,"type",void 0),e([p({constructOnly:!0,nonNullable:!0})],w.prototype,"analysis",void 0),e([p({readOnly:!0})],w.prototype,"updating",null),e([p()],w.prototype,"_stopPreviewingTask",void 0),e([p()],w.prototype,"_forcePreview",void 0),e([p()],w.prototype,"_autoRestoreForcePreviewEnabled",void 0),e([p()],w.prototype,"_previewing",null),e([p()],w.prototype,"_effectiveUtcOffset",null),e([p()],w.prototype,"_utcOffsetAuto",null),e([p()],w.prototype,"_dateUTCOffset",null),e([p()],w.prototype,"_startDateTimeUTC",null),e([p()],w.prototype,"_endDateTimeUTC",null),e([p()],w.prototype,"_referencePosition",null),e([p()],w.prototype,"_interval",null),e([p()],w.prototype,"_intervalContext",null),e([p()],w.prototype,"_durationSampleCount",null),e([p()],w.prototype,"_duration",null),e([p()],w.prototype,"_lightDirections",null),e([p()],w.prototype,"_lightDirectionsContext",null),e([p()],w.prototype,"_visualizationParameters",null),e([p()],w.prototype,"_thresholdVisualizationParameters",null),e([p()],w.prototype,"_thresholdDiscreteVisualizationParameters",null),e([p()],w.prototype,"_durationVisualizationParameters",null),e([p()],w.prototype,"_discreteVisualizationParameters",null),e([p()],w.prototype,"_forcePreviewDependencies",null),e([p()],w.prototype,"_renderer",null),w=e([_("esri.views.3d.analysis.ShadowCastAnalysisView3D")],w);const D=w;function P(e,t){null!=t&&e?.setParameters({shadowCast:t})}function C(e){if(e.suspended)return!1;switch(e.type){case"building-scene-3d":case"csv-3d":case"elevation-3d":case"feature-3d":case"geojson-3d":case"graphics-3d":case"integrated-mesh-3d":case"integrated-mesh-3dtiles":case"ogc-feature-3d":case"route-3d":case"scene-layer-3d":case"scene-layer-graphics-3d":case"stream-3d":case"wms-3d":case"catalog-footprint-3d":return!0;default:return!1}}const T=h(1,"hours","milliseconds"),U=500,O=255,b=m(),z=[];export{D as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{neverReached as i}from"../../../core/compilerUtils.js";import{destroyHandle as e}from"../../../core/handleUtils.js";import{clone as n}from"../../../core/lang.js";import{property as r,cast as s,subclass as g}from"../../../core/accessorSupport/decorators.js";import{ensureOneOfType as h}from"../../../core/accessorSupport/ensureType.js";import{lightingTypes as o}from"./lightingUtils.js";import l from"./SunLighting.js";import a from"./VirtualLighting.js";import c from"../../../webscene/Environment.js";import p from"../../../webscene/SunLighting.js";import u from"../../../webscene/VirtualLighting.js";var m;let b=class extends c{static{m=this}constructor(t){super(t),this.lighting=this.castLighting(),this._computeWeatherAvailable=void 0,this.cachedCameraTrackingEnabled=null}static fromWebsceneEnvironment(t){const i=t.cloneConstructProperties();return new m({...i,lighting:i.lighting?"virtual"===i.lighting.type?a.fromWebsceneLighting(i.lighting):l.fromWebsceneLighting(i.lighting):void 0})}get weatherAvailable(){return this._computeWeatherAvailable?.()??!1}setComputeWeatherAvailable(t){this._computeWeatherAvailable=t}castLighting(t){return this._convertLightingWithDestroy(t)}applyLighting(t){this.lighting=this._convertLightingWithDestroy(t)}_convertLightingWithDestroy(t){const i=this._convertLighting(t);return i!==t&&this.addHandles(e(i)),i}_convertLighting(t){return t?t instanceof l||t instanceof a?t:t instanceof p?this.lighting&&"virtual"!==this.lighting.type?this.lighting.cloneWithWebsceneLighting(t):new l({...t.cloneConstructProperties(),...this.lighting?.cloneNonPersistentConstructProperties()}):t instanceof u?this.lighting&&"virtual"===this.lighting.type?this.lighting.cloneWithWebsceneLighting(t):new a({...t.cloneConstructProperties(),...this.lighting?.cloneNonPersistentConstructProperties()}):h(o,t):new l}clone(){return new m({lighting:this.lighting.clone(),weather:this.weather.clone(),atmosphereEnabled:this.atmosphereEnabled,starsEnabled:this.starsEnabled,background:n(this.background)})}cloneWithWebsceneEnvironment(t){return new m({weather:this.weather.clone(),atmosphereEnabled:this.atmosphereEnabled,starsEnabled:this.starsEnabled,background:n(this.background),...t.cloneConstructProperties(),lighting:this._getLighting(t)})}_getLighting(t){switch(t.lighting.type){case"sun":return this.lighting&&"sun"===this.lighting.type?this.lighting.cloneWithWebsceneLighting(t.lighting):l.fromWebsceneLighting(t.lighting);case"virtual":return this.lighting&&"virtual"===this.lighting.type?this.lighting.cloneWithWebsceneLighting(t.lighting):a.fromWebsceneLighting(t.lighting);default:return i(t.lighting),l.fromWebsceneLighting(t.lighting)}}};t([r({types:o,nonNullable:!0})],b.prototype,"lighting",void 0),t([r()],b.prototype,"_computeWeatherAvailable",void 0),t([r({readOnly:!0})],b.prototype,"weatherAvailable",null),t([s("lighting")],b.prototype,"castLighting",null),b=m=t([g("esri.views.3d.environment.SceneViewEnvironment")],b);const d=b;export{d as default};
|
|
5
|
+
import{__decorate as t}from"tslib";import{neverReached as i}from"../../../core/compilerUtils.js";import{destroyHandle as e}from"../../../core/handleUtils.js";import{clone as n}from"../../../core/lang.js";import{property as r,cast as s,subclass as g}from"../../../core/accessorSupport/decorators.js";import{ensureOneOfType as h}from"../../../core/accessorSupport/ensureType.js";import{lightingTypes as o}from"./lightingUtils.js";import l from"./SunLighting.js";import a from"./VirtualLighting.js";import c from"../../../webscene/Environment.js";import p from"../../../webscene/SunLighting.js";import u from"../../../webscene/VirtualLighting.js";var m;let b=class extends c{static{m=this}constructor(t){super(t),this.lighting=this.castLighting(),this._computeWeatherAvailable=void 0,this.cachedCameraTrackingEnabled=null}static fromWebsceneEnvironment(t){const i=t.cloneConstructProperties();return new m({...i,lighting:i.lighting?"virtual"===i.lighting.type?a.fromWebsceneLighting(i.lighting):l.fromWebsceneLighting(i.lighting):void 0})}get weatherAvailable(){return this._computeWeatherAvailable?.()??!1}setComputeWeatherAvailable(t){this._computeWeatherAvailable=t}castLighting(t){return this._convertLightingWithDestroy(t)}applyLighting(t){this.lighting=this._convertLightingWithDestroy(t)}_convertLightingWithDestroy(t){const i=this._convertLighting(t);return i!==t&&this.addHandles(e(i)),i}_convertLighting(t){return t?t instanceof l||t instanceof a?t:t instanceof p?this.lighting&&"virtual"!==this.lighting.type?this.lighting.cloneWithWebsceneLighting(t):new l({...t.cloneConstructProperties(),...this.lighting?.cloneNonPersistentConstructProperties()}):t instanceof u?this.lighting&&"virtual"===this.lighting.type?this.lighting.cloneWithWebsceneLighting(t):new a({...t.cloneConstructProperties(),...this.lighting?.cloneNonPersistentConstructProperties()}):h(o,t):new l}clone(){return new m({lighting:this.lighting.clone(),weather:this.weather.clone(),atmosphereEnabled:this.atmosphereEnabled,starsEnabled:this.starsEnabled,background:n(this.background)})}cloneWithWebsceneEnvironment(t){return new m({weather:this.weather.clone(),atmosphereEnabled:this.atmosphereEnabled,starsEnabled:this.starsEnabled,background:n(this.background),...t.cloneConstructProperties(),lighting:this._getLighting(t)})}_getLighting(t){switch(t.lighting.type){case"sun":return this.lighting&&"sun"===this.lighting.type?this.lighting.cloneWithWebsceneLighting(t.lighting):l.fromWebsceneLighting(t.lighting);case"virtual":return this.lighting&&"virtual"===this.lighting.type?this.lighting.cloneWithWebsceneLighting(t.lighting):a.fromWebsceneLighting(t.lighting);default:return i(t.lighting),l.fromWebsceneLighting(t.lighting)}}};t([r({types:{defaultKeyValue:"sun",...o},nonNullable:!0})],b.prototype,"lighting",void 0),t([r()],b.prototype,"_computeWeatherAvailable",void 0),t([r({readOnly:!0})],b.prototype,"weatherAvailable",null),t([s("lighting")],b.prototype,"castLighting",null),b=m=t([g("esri.views.3d.environment.SceneViewEnvironment")],b);const d=b;export{d as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{valueInUnit as e}from"../../../../../core/quantity.js";import{createScreenPointArray as r,createRenderScreenPointArray3 as o}from"../../../../../core/screenUtils.js";import{getMetersPerUnitForSR as t}from"../../../../../core/units.js";import{fromValues as n}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as s,D as i,E as c,e as l,c as a}from"../../../../../chunks/vec32.js";import{create as
|
|
5
|
+
import{valueInUnit as e}from"../../../../../core/quantity.js";import{createScreenPointArray as r,createRenderScreenPointArray3 as o}from"../../../../../core/screenUtils.js";import{getMetersPerUnitForSR as t}from"../../../../../core/units.js";import{fromValues as n}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as s,D as i,E as c,e as l,c as a}from"../../../../../chunks/vec32.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{geodesicCompatibleSpatialReference as p,inverseGeodeticSolver as f,InverseGeodeticSolverResult as u,directGeodeticSolver as d}from"../../../../../geometry/geodesicUtils.js";import{projectPoint as j}from"../../../../../geometry/projectionUtils.js";import{projectVectorToVector as g}from"../../../../../geometry/projection/projectVectorToVector.js";import{getNormal as y,fromPositionAndNormal as h,create as R}from"../../../../../geometry/support/plane.js";import{makeDehydratedPoint as v}from"../../../../../layers/graphics/dehydratedPoint.js";import{getZForElevationMode as x}from"../../../../../support/elevationInfoUtils.js";import{OffsetEdgeVertex as C}from"../../../../interactive/editGeometry/operations/OffsetEdgeVertex.js";function H(e,r,o){const t="on-the-ground"===o.mode?1:0;return new C(e,t,r,0)}function w(e,r,o){const t=m();if(!e.renderCoordsHelper.toRenderCoords(r,t))return null;const n=T(e,r,y(o.plane)),i=T(e,r,o.edgeDirection);if(null==n||null==i)return null;const c=s(m(),n,i);return h(t,c,R())}function T(e,r,o){const t=v(r.x+o[0],r.y+o[1],r.z+o[2],r.spatialReference),n=m(),s=m();return e.renderCoordsHelper.toRenderCoords(r,n)&&e.renderCoordsHelper.toRenderCoords(t,s)?i(s,n,s):null}function U(e,r,o){const t=y(e),c=i(m(),r,o),l=s(m(),c,t),a=s(m(),c,l);return n(c[0],c[1],c[2],0,l[0],l[1],l[2],0,a[0],a[1],a[2],0,0,0,0,1)}function q(e,r,t){const n=t.projectToRenderScreen(e,o()),s=t.projectToRenderScreen(r,o());return null!=n&&null!=s?c(l(n,n,s)):0}function A(e,o,t,n){const{elevationInfo:s,operations:i}=t;if(!i||!e)return null;const c=n.manipulator.elevationAlignedLocation,l=x(c,o,s),a=o.sceneIntersectionHelper.intersectElevationFromScreen(r(e.x,e.y),s,l);return a&&j(a,a,i.data.spatialReference)?a:null}function E(r,o,n,{data:{coordinateHelper:s,spatialReference:i}}){const c=e(r,"meters"),l=t(i),j=Math.sign(c*n.selectedArrow),h=p(i),R=y(n.plane),v=s.pointToXYZ(o),x=m();a(x,v,R,j*(I/l));const C=c*n.selectedArrow/l;if(!h||!g(v,i,v,h)||!g(x,i,x,h))return C;const H=new u;if(f(H,v,x,h),d(x,v,H.azimuth,c,h),!g(x,h,x,i))return C;const w=x[0]-o.x,T=x[1]-o.y,U=Math.sqrt(w*w+T*T)*j,[q,A]=R,E=Math.sqrt(q*q+A*A);return 0===E?0:U/E}const I=10;export{w as createEdgeOffsetIntersectionPlane,H as createEdgeOffsetOperation,U as edgeOffsetRotationMatrix,E as getDistanceInGeometrySR,A as getMapPointAtEdgeOffsetManipulatorElevation,q as screenEdgeLengthSquared};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as s}from"tslib";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerView3D as a}from"./LayerView3D.js";import{LayerViewAnalysisViewManager as r}from"./support/LayerViewAnalysisViewManager.js";import
|
|
5
|
+
import{__decorate as s}from"tslib";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerView3D as a}from"./LayerView3D.js";import{LayerViewAnalysisViewManager as r}from"./support/LayerViewAnalysisViewManager.js";import{DimensionLayerViewMixin as n}from"../../layers/DimensionLayerViewMixin.js";import t from"../../layers/LayerView.js";var o;let l=class extends(a(n(t))){static{o=this}constructor(s){super(s),this.type="dimension-3d",this._analysisViewManager=null}initialize(){this._analysisViewManager=new r({getAnalysis:()=>this.layer.analysis,loadAnalysisViewModule:o.loadAnalysisViewModule,parent:this}),this.addResolvingPromise(this._analysisViewManager.whenAnalysisView())}destroy(){this._analysisViewManager.destroy()}get analysisView(){return this._analysisViewManager.analysisView}whenAnalysisView(){return this._analysisViewManager.whenAnalysisView()}isUpdating(){return this._analysisViewManager.updating}static{this.loadAnalysisViewModule=()=>import("../analysis/DimensionAnalysisView3D.js")}};s([i()],l.prototype,"type",void 0),s([i()],l.prototype,"_analysisViewManager",void 0),s([i({readOnly:!0})],l.prototype,"analysisView",null),l=o=s([e("esri.views.3d.layers.DimensionLayerView3D")],l);const y=l;export{y 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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import r from"../../../core/Error.js";import has from"../../../core/has.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../core/reactiveUtils.js";import{property as a,subclass as u}from"../../../core/accessorSupport/decorators.js";import{getObjectId as o}from"../../../layers/graphics/dehydratedFeatures.js";import{packFields as n}from"../../../layers/support/fieldUtils.js";import{FeatureLikeLayerView3D as p}from"./FeatureLikeLayerView3D.js";import{LayerView3D as l}from"./LayerView3D.js";import{FeatureGraphics3DGraphicsPipeline as m}from"./graphics/FeatureGraphics3DGraphicsPipeline.js";import{updatingProgress as d}from"../support/updatingProperties.js";import c
|
|
5
|
+
import{__decorate as e}from"tslib";import r from"../../../core/Error.js";import has from"../../../core/has.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../core/reactiveUtils.js";import{property as a,subclass as u}from"../../../core/accessorSupport/decorators.js";import{getObjectId as o}from"../../../layers/graphics/dehydratedFeatures.js";import{packFields as n}from"../../../layers/support/fieldUtils.js";import{FeatureLikeLayerView3D as p}from"./FeatureLikeLayerView3D.js";import{LayerView3D as l}from"./LayerView3D.js";import{FeatureGraphics3DGraphicsPipeline as m}from"./graphics/FeatureGraphics3DGraphicsPipeline.js";import{updatingProgress as d}from"../support/updatingProperties.js";import{FeatureLayerViewMixin as c}from"../../layers/FeatureLayerViewMixin.js";import y from"../../layers/LayerView.js";import{RefreshableLayerView as h}from"../../layers/RefreshableLayerView.js";let f=class extends(h(p(c(l(y))))){constructor(e){super(e)}initialize(){this.addHandles(i(()=>this._updatingRequiredPromise,e=>this._updatingHandles.addPromise(e),s))}destroy(){this._updatingHandles.removeAll(),this._fetcherContext=t(this._fetcherContext)}get maximumNumberOfFeatures(){return this.graphicsPipeline.maximumNumberOfFeatures}set maximumNumberOfFeatures(e){this.graphicsPipeline.maximumNumberOfFeatures=e}get maximumNumberOfFeaturesExceeded(){return null!=this.graphicsPipeline&&!this.suspended&&this.graphicsPipeline.maximumNumberOfFeaturesExceeded}get updatingProgressValue(){return this.graphicsPipeline?.updatingProgressValue??0}get updatePolicy(){return this.graphicsPipeline?.updatePolicy??0}get snappingComplexityExceeded(){return this.graphicsPipeline?.snappingComplexityExceeded??!0}get hasZ(){const e=this.layer,r=e.capabilities&&e.capabilities.data;return!(!r||!r.supportsZ)&&("returnZ"in e&&null!=e.returnZ?e.returnZ:r.supportsZ)}get hasM(){const e=this.layer,r=e.capabilities&&e.capabilities.data;return!(!r||!r.supportsM)&&("returnM"in e&&null!=e.returnM&&e.returnM)}get availableFieldsForQuery(){return n(this.layer.fieldsIndex,this.availableFields)}setVisibility(e,r){this.graphicsPipeline?.setVisibility(e,r)}createQuery(){return super.createQuery()}queryFeatures(e,r){const t=()=>super.queryFeatures(e,r);return"mesh"===this.layer.geometryType?this._queryFeaturesMesh(this._ensureQuery(e),t):t()}async createGraphicsPipeline(){if(has("feature-pipeline-3d-test")){const{Feature3DPipeline:e}=await import("./graphics/pipeline/Feature3DPipeline.js");return new e({layerView:this})}return new m({layerView:this})}async doRefresh(e){return await this.graphicsPipeline.doRefresh(e)}_popupFeatureHasRequiredFields(e,r){if(!super._popupFeatureHasRequiredFields(e,r))return!1;const t=o(e,this.layer.objectIdField);if(null==t)return!0;const i=this.graphicsPipeline.getMissingAttributesForFeature(t);if(null==i)return!0;for(const s of r)if(i.has(s))return!1;return!0}get usedMemory(){return this.graphicsPipeline?.usedMemory??0}get unloadedMemory(){return this.graphicsPipeline?.unloadedMemory??0}get ignoresMemoryFactor(){return this.graphicsPipeline?.ignoresMemoryFactor??!1}async _queryFeaturesMesh(e,r){this._validateQueryFeaturesMesh(e);const t=await r(),i=this.graphicsPipeline;if(e?.outStatistics||null==i)return t;const s=this.layer.objectIdField,a=[];for(const u of t.features)if(u.geometry){const e=i.getHydratedGeometry(u.attributes[s]);e&&(u.geometry=e,a.push(u))}else a.push(u);return t.features=a,t}_validateQueryFeaturesMesh(e){if(!e)return;const t=e=>{throw new r("feature-layer-view:unsupported-query",`Queries on Mesh feature collection layers do not support '${e}'`)},i=["quantizationParameters","geometryPrecision","maxAllowableOffset"];for(const r of i)null!=e[r]&&t(r);"returnM"in e&&e.returnM&&t("returnM"),"returnCentroid"in e&&e.returnCentroid&&t("returnCentroid"),null==e.outSpatialReference||e.outSpatialReference.equals(this.view.spatialReference)||t("outSpatialReference")}get test(){}};e([a()],f.prototype,"layer",void 0),e([a()],f.prototype,"graphicsPipeline",void 0),e([a()],f.prototype,"maximumNumberOfFeatures",null),e([a()],f.prototype,"maximumNumberOfFeaturesExceeded",null),e([a(d)],f.prototype,"updatingProgress",void 0),e([a({readOnly:!0})],f.prototype,"updatingProgressValue",null),e([a({readOnly:!0})],f.prototype,"updatePolicy",null),e([a()],f.prototype,"snappingComplexityExceeded",null),e([a({readOnly:!0})],f.prototype,"hasZ",null),e([a({readOnly:!0})],f.prototype,"hasM",null),e([a()],f.prototype,"availableFieldsForQuery",null),f=e([u("esri.views.3d.layers.FeatureLayerViewBase3D")],f);export{f 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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import i from"../../../core/Error.js";import{makeHandle as r}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{property as
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import i from"../../../core/Error.js";import{makeHandle as r}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import{destroyMaybe as s}from"../../../core/maybe.js";import n from"../../../core/ReactiveMap.js";import{property as l,subclass as h}from"../../../core/accessorSupport/decorators.js";import{hydrateGraphic as o}from"../../../layers/graphics/hydratedFeatures.js";import{combineTimeExtent as a}from"../../../layers/support/timeSupport.js";import p from"../../../rest/support/AttributeBinsQuery.js";import u from"../../../rest/support/Query.js";import{isGraphic as g}from"../../../support/guards.js";import{attributeLookup as c}from"./support/attributeUtils.js";import{normalizeHighlightTarget as y,emptyHighlightHandle as d,isObjectId as m}from"./support/highlightUtils.js";import{getHighlightName as f}from"../../support/highlightOptionsUtils.js";import{isInEffectiveScaleRange as P,hasLayerBasedScaleVisibility as b}from"../../support/layerViewUtils.js";import{projectWithZConversionSilent as v}from"../../support/projectionUtils.js";const w=w=>{const I=w;let _=class extends I{constructor(){super(...arguments),this.highlightOptions=null,this.updatePolicy=1,this.slicePlaneEnabled=!1,this._highlightCounter=new n,this.fullExtentInLocalViewSpatialReference=null,this.supportsHeightUnitConversion=!0}initialize(){const e=this.layer;"isTable"in e&&e.isTable?this.addResolvingPromise(Promise.reject(new i("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e}))):(this.addResolvingPromise(this._validateGeometryType()),this.addResolvingPromise((async()=>{if(this.destroyed)return;this.fullExtentInLocalViewSpatialReference="local"===this.view.viewingMode?await v(this.layer.fullExtent,this.view.spatialReference):null;const e=await this.createGraphicsPipeline();this.destroyed?e.destroy():(this.graphicsPipeline=e,await e.when())})()),this.notifyChange("updating"))}destroy(){this.graphicsPipeline=s(this.graphicsPipeline)}get dataUpdating(){return!!this.graphicsPipeline?.dataUpdating}get legendEnabled(){return this.canResume()&&this.graphicsPipeline?.legendEnabled}get visibleAtCurrentScale(){return b()?P(this.layer.effectiveScaleRange,this.view.scale):!this.graphicsPipeline?.scaleVisibilitySuspended}get symbologySnappingSupported(){return this.graphicsPipeline.symbologySnappingSupported}get hasAllFeatures(){return this.graphicsPipeline.hasAllFeatures}get hasAllFeaturesInView(){return this.graphicsPipeline.hasAllFeaturesInView}get hasFullGeometries(){return this.graphicsPipeline.hasFullGeometries}get timeExtent(){return a(this.layer,this.view?.timeExtent,this._get("timeExtent"))}get highlightIds(){return Array.from(this._highlightCounter.keys())}get hasHighlight(){return this.highlightIds.length>0}getHit(e,t){if(has("feature-pipeline-3d-test"))return this._getHitMock(e);const i=this.graphicsPipeline.findGraphic(t=>t.uid===e);if(null==i)return null;const r=o(i,this.layer,this.layer.graphicOrigin);return{type:"graphic",graphic:r,layer:r.layer}}_getHitMock(e){const i=this.layer,r={};r[this.layer.objectIdField]=e;const s=new t({layer:i,sourceLayer:i,origin:this.graphicOrigin,visible:!0,symbol:null,attributes:r,geometry:null});return{type:"graphic",graphic:s,layer:s.layer}}whenGraphicBounds(e,t){return this.graphicsPipeline?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.graphicsPipeline?.computeAttachmentOrigin(e,t)}async elevationAlignPointsInFeatures(e,t){return this.graphicsPipeline.elevationAlignPointsInFeatures(e,t)}async queryForSymbologySnapping(e,t){return this.graphicsPipeline.graphicsQuery.queryForSymbologySnapping(e,t)}queryFeatures(e,t){return this.graphicsPipeline.graphicsQuery.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForCount(this._ensureQuery(e),t?.signal)}async queryAttributeBins(e,t){return this.graphicsPipeline.graphicsQuery.executeAttributeBinsQuery(this._ensureAttributeBinsQuery(e),t?.signal)}queryExtent(e,t){return this.graphicsPipeline.graphicsQuery.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return null==e?this.createQuery():u.from(e)}_ensureAttributeBinsQuery(e){const t=p.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t}_addHighlightIds(e){this._highlightCounter.batch(()=>{for(const t of e){const e=this._highlightCounter.get(t)??0;this._highlightCounter.set(t,e+1)}})}_removeHighlightIds(e){this._highlightCounter.batch(()=>{for(const t of e){let e=this._highlightCounter.get(t);null!=e&&(e--,e>0?this._highlightCounter.set(t,e):this._highlightCounter.delete(t))}})}highlight(e,t){const i=f(t),s=this.layer.objectIdField,n=y(e);if(0===n.length)return d;if(g(n[0])){const e=n;if(null!=c(this.layer.fieldsIndex,e[0].attributes,s)){const t=e.map(e=>c(this.layer.fieldsIndex,e.attributes,s)),n=this.graphicsPipeline.highlightByObjectIds(t,i);return this._addHighlightIds(t),r(()=>{this._removeHighlightIds(t),n.remove()})}return this.graphicsPipeline.highlightByGraphics(e,i)}if(m(n[0])){const e=n;this._addHighlightIds(e);const t=this.graphicsPipeline.highlightByObjectIds(e,i);return r(()=>{t.remove(),this._removeHighlightIds(e)})}return d}maskOccludee(e){return this.graphicsPipeline.maskOccludee(e)}getSuspendInfo(){return{...super.getSuspendInfo(),...this.graphicsPipeline.suspendInfo}}isUpdating(){return!(!this.graphicsPipeline||this.graphicsPipeline.destroyed)&&!(!this.graphicsPipeline?.updating&&this.view?.basemapTerrain?.ready)}async _validateGeometryType(){switch(this.layer.geometryType){case"multipatch":case"multipoint":throw new i("featurelayerview3d:unsupported-geometry-type","Unsupported geometry type ${geometryType}",{geometryType:this.layer.geometryType})}}get performanceInfo(){return this.graphicsPipeline.performanceInfo}queryAggregates(){throw new Error("Not implemented")}};return e([l()],_.prototype,"graphicsPipeline",void 0),e([l({readOnly:!0})],_.prototype,"dataUpdating",null),e([l()],_.prototype,"highlightOptions",void 0),e([l()],_.prototype,"suspended",void 0),e([l({readOnly:!0})],_.prototype,"legendEnabled",null),e([l({readOnly:!0})],_.prototype,"visibleAtCurrentScale",null),e([l()],_.prototype,"updating",void 0),e([l({readOnly:!0})],_.prototype,"updatePolicy",void 0),e([l({type:Boolean})],_.prototype,"slicePlaneEnabled",void 0),e([l({readOnly:!0})],_.prototype,"suspendInfo",void 0),e([l()],_.prototype,"symbologySnappingSupported",null),e([l({readOnly:!0})],_.prototype,"hasAllFeatures",null),e([l({readOnly:!0})],_.prototype,"hasAllFeaturesInView",null),e([l({readOnly:!0})],_.prototype,"hasFullGeometries",null),e([l({readOnly:!0})],_.prototype,"timeExtent",null),e([l()],_.prototype,"highlightIds",null),e([l()],_.prototype,"hasHighlight",null),_=e([h("esri.views.3d.layers.FeatureLikeLayerView3D")],_),_};export{w as FeatureLikeLayerView3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../Color.js";import i from"../../../Graphic.js";import{removeUnordered as s,isSome as r}from"../../../core/arrayUtils.js";import has from"../../../core/has.js";import o from"../../../core/Logger.js";import{equals as n}from"../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../core/maybe.js";import l from"../../../core/PooledArray.js";import{ignoreAbortErrors as d,isAbortError as h,throwIfAborted as c,createResolver as u}from"../../../core/promiseUtils.js";import{initial as _,watch as g}from"../../../core/reactiveUtils.js";import{schedule as m}from"../../../core/scheduling.js";import{equals as f}from"../../../core/SetUtils.js";import{isArrayBuffer as p}from"../../../core/typedArrayUtil.js";import{property as y,subclass as b}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as v,invert as I}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as C}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as M,getTranslation as w}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{clone as x,create as R}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as S}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{h as O,p as j,t as E,a as F,i as V,j as D,e as T,H as A}from"../../../chunks/vec32.js";import{create as H}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as N}from"../../../chunks/vec42.js";import{fromValues as P}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as k}from"../../../core/support/UpdatingHandles.js";import{getSphericalPCPF as U}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{localLinearScaleFactors as L}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectBoundingSphere as G}from"../../../geometry/projection/projectBoundingSphere.js";import{projectBuffer as B}from"../../../geometry/projection/projectBuffer.js";import{getProjectorName as q}from"../../../geometry/projection/projectors.js";import{projectVectorToVector as z}from"../../../geometry/projection/projectVectorToVector.js";import{fromBuffer as W,create as $,toRect as K}from"../../../geometry/support/aaBoundingBox.js";import{create as Q,intersects as J}from"../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as Y,ensurePackedMat4f64 as X}from"../../../geometry/support/DoubleArray.js";import{compactFloatArray as Z}from"../../../geometry/support/FloatArray.js";import{compactIndices as ee}from"../../../geometry/support/Indices.js";import{Sphere as te}from"../../../geometry/support/sphere.js";import{newUByteArray as ie}from"../../../geometry/support/UByteArray.js";import{fallbackObjectIDAttribute as se}from"../../../layers/LayerConstants.js";import re from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as oe}from"../../../layers/support/fieldUtils.js";import ne from"../../../layers/support/SceneModification.js";import{getColor as ae,getOpacity as le}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{isBasemapLayerView as de}from"../../../support/basemapUtils.js";import{getElevationOffset as he}from"../../../support/elevationInfoUtils.js";import{loadArcade as ce}from"../../../support/loadArcade.js";import ue from"../../../symbols/MeshSymbol3D.js";import _e from"../../../symbols/SimpleFillSymbol.js";import{ContentGeometryUpdateEvent as ge}from"./ContentGeometryLayerView.js";import me from"./I3SMeshViewLabeler.js";import{I3SMeshViewPerformanceInfo as fe}from"./I3SMeshViewPerformanceInfo.js";import{I3SMeshWorkerHandle as pe,toWasmModification as ye}from"./I3SMeshWorkerHandle.js";import{initialize as be,setModificationsSync as ve,filterObbsForModificationsSync as Ie,interpretObbModificationResults as Ce}from"./SceneLayerWorker.js";import{overrideColor as Me}from"./graphics/graphicUtils.js";import{areLabelsVisible as we}from"./graphics/Labeler.js";import xe from"./i3s/Highlights.js";import{I3SAsyncElevationUpdater as Re}from"./i3s/I3SAsyncElevationUpdater.js";import{getCachedAttributeValue as Se}from"./i3s/I3SBinaryReader.js";import{I3SCrossfadeHelper as Oe,NodeCrossfadeMetaData as je}from"./i3s/I3SCrossfadeHelper.js";import{boundingBoxCornerPoints as Ee}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Fe}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as Ve,selectEncoding as De,defaultMaterial as Te,createTexture as Ae,configureMaterial as He}from"./i3s/I3SMaterialUtil.js";import{I3SOverrides as Ne}from"./i3s/I3SOverrides.js";import{computeGlobalTransformation as Pe}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as ke,checkSceneLayerValid as Ue,checkSceneLayerCompatibleWithView as Le,whenGraphicAttributes as Ge,computeVisibilityObb as Be,filterInPlace as qe,intersectBoundingRectWithMbs as ze,addWraparound as We,getSymbolInfo as $e,transparentEdgeMaterial as Ke,getClipRect as Qe}from"./i3s/I3SUtil.js";import{IDBCache as Je}from"./i3s/IDBCache.js";import{IDBMockCache as Ye}from"./i3s/IDBMockCache.js";import{LayerElevationProvider as Xe}from"./i3s/LayerElevationProvider.js";import{SymbologyInfo as Ze}from"./i3s/SymbologyInfo.js";import{attributeLookup as et}from"./support/attributeUtils.js";import{normalizeHighlightTarget as tt,emptyHighlightHandle as it}from"./support/highlightUtils.js";import{makeScheduleFunction as st}from"./support/makeScheduleFunction.js";import{debugFlags as rt}from"../support/debugFlags.js";import{ElevationRange as ot}from"../support/ElevationRange.js";import{toBoundingRect as nt}from"../support/extentUtils.js";import{Obb as at,ensurePackedObbData as lt}from"../support/orientedBoundingBox.js";import{updatingProgress as dt}from"../support/updatingProperties.js";import{glLayout as ht}from"../support/buffer/glUtil.js";import{ObjectParameters as ct}from"../webgl-engine/collections/Component/ObjectParameters.js";import{createVertexBufferLayout as ut,SourceGeometry as _t,GeometryParameters as gt}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as mt}from"../webgl-engine/collections/Component/Transform.js";import{emissiveStrengthDefault as ft}from"../webgl-engine/core/shaderLibrary/output/Emissions.glsl.js";import{loadBasisTranscoder as pt}from"../webgl-engine/lib/BasisUtil.js";import{getHighlightName as yt}from"../../support/highlightOptionsUtils.js";import{TextureCompressionTracker as bt}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as vt}from"../../../webscene/support/AlphaCutoff.js";const It=[1,1,1,1];class Ct extends je{constructor(e,t,i,s,r,o,n,a,l){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=n,this.anchorIds=a,this.anchors=l,this.cachedElevationAnchors=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbologyStride=5}get usedMemory(){return this.node.memory}get featureExtents(){return this._featureExtents??=new Float64Array(6*this.featureIds.length).fill(Number.POSITIVE_INFINITY),this._featureExtents}}const Mt=26,wt=104857600,xt=t=>{const p=t;let A=class extends p{constructor(){super(...arguments),this._applySSAO=!0,this._shadeNormals=!0,this._updatingHandles=new k,this._highlights=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._compressionTracker=new bt,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._hasComponentData=!1,this._hasVertexColors=!1,this._nodeColorOverride=null,this.updating=!0,this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.slicePlaneEnabled=!1,this._modifications=new Array,this.ignoresMemoryFactor=!1,this._layerUrl="",this._cacheKeySuffix=null,this._planetRadiusInGlobalMode=0,this._elevationTask=null,this._needFilterResolve=!1,this._filters=[],this._arcade=null,this._tmpAttributeOnlyGraphic=new i,this._crossfadeHelper=new Oe(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerViewUid(){return this.uid}get layerId(){return this.i3slayer.id}get sublayerId(){return null}get _isIntegratedMesh(){return"integrated-mesh"===this.i3slayer.type}get contentVisible(){return!this.suspended&&this._controller?.rootNodeVisible&&this.fullOpacity>vt}get legendEnabled(){return this.contentVisible&&!0===this.i3slayer?.legendEnabled}get updatingProgressValue(){return this._controller?.updatingProgress??0}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return ke(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?63:37:this._usePBR||this._hasLoadedPBRTextures?44:36}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;return null!=e&&"absolute-height"===e.mode?he(e,this.i3slayer.spatialReference):0}get elevationInfo(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null==e)return new kt(0,0);const t=he(e,this.i3slayer.spatialReference);switch(e.mode){case"absolute-height":return new kt(0,t);case"relative-to-ground":return new kt(1,t);case"on-the-ground":return new kt(2,0);default:return new kt(0,0)}}get supportedTextureEncodings(){return Ve(this.view.stage.renderView.capabilities)}get clientGeometry(){return this.i3sOverrides.geometryOverrides}get elevationRange(){const e=this._nodeId2Meta,t=new ot;for(const i of e.values()){const e=i?.node.serviceMbsInIndexSR;e&&t.expandElevationRangeValues(e.center[2]-e.radius,e.center[2]+e.radius)}return t.elevationRangeValid?t:null}get fullExtent(){return this.i3slayer.fullExtent}initialize(){const e=has("enable-feature:idb-mock-cache");this._idbCache=e?new Ye(this.view,e):new Je("esri-scenelayer-cache","geometries"),this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const t=this.view.resourceController,i=t.memoryController;this.i3sOverrides=new Ne({view:this.view,layer:this.i3slayer,memoryController:i}),this._workerHandle=new pe(st(t)),this.addResolvingPromise(this._workerHandle.promise);const s=this.i3slayer.store;this.addResolvingPromise(this._workerHandle.setLegacySchema(this.uid,s.defaultGeometrySchema).catch(d)),Ue(this.i3slayer),Le(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new re({layerView:this,worker:this._workerHandle}),this._gpuMemoryEstimate=0,this._texMemoryEstimate=0,this._geoMemoryEstimate=0,this._stage=this.view.stage,this._collection=this._stage.renderView.componentObjectCollection;const r=s.defaultGeometrySchema;if(this._isIntegratedMesh||!r)this._hasComponentData=!1;else{const e=r.featureAttributes;this._hasComponentData=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=(r?.vertexAttributes.color??null)&&!this.i3slayer.cachedDrawingInfo?.color;const n=this.view.resourceController.memoryController.newCache(`sl-${this.uid}`,e=>this._deleteComponentObject(e));this._memCache=n;const l=this._controller,h=this._nodeId2Meta,c=this._nodeId2MetaReloading,u=e=>{const t=l.index;if(!t)return;const i=t.rootNode;if(!i)return;const s=t=>{const i=t.index,s=h.get(i)||c.get(i);return e(t,s?.objectHandle??null)};t.traverse(i,s)};this._intersectionHandler=new Fe({layerViewUid:this.layerViewUid,sublayerId:this.sublayerId,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:u}),this._elevationProvider=new Xe({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this._updatingHandles.add(()=>this.view.clippingArea,()=>this._clippingAreaChanged(),_),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),_),this._updatingHandles.add(()=>!this.suspended&&0!==this.elevationInfo.mode,(e,t)=>{e?this.addHandles(this.view.basemapTerrain.on("elevation-change",({extent:e})=>this._ensureElevationTask().addExtent(e)),Gt):t&&this.removeHandles(Gt)},_),this._updatingHandles.add(()=>this._usePBR,e=>this._updatePBR(e));const m=()=>{this._reloadAll(),this.clearMemCache()};this._updatingHandles.add(()=>this.rendererTextureUsage,m),this._updatingHandles.add(()=>this.contentVisible,e=>this._contentVisibleChanged(e),_),this._updatingHandles.add(()=>this.i3slayer.labelsVisible,()=>this._labelingChanged(),_),this._updatingHandles.add(()=>this.i3slayer.labelingInfo,()=>this._labelingChanged(),_),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),_),this.addHandles([g(()=>rt.I3S_TREE_SHOW_TILES,e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then(({I3STreeDebugger:t})=>{!this._treeDebugger&&rt.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else e||rt.I3S_TREE_SHOW_TILES||(this._treeDebugger=a(this._treeDebugger))},_),g(()=>rt.I3S_SHOW_MODIFICATIONS,()=>this._showModifications(),_)]),this._cacheKeySuffix=this._getCacheKeySuffix(),this._idbCache.init().catch(e=>o.getLogger(this).warn(`Failed to initialize IndexedDB cache: ${e}`));const{view:f}=this,{viewingMode:p,renderCoordsHelper:y}=f;this._planetRadiusInGlobalMode="local"===p?0:y.referenceEllipsoid.radius}destroy(){this._clearAddTasks(),this._elevationTask=a(this._elevationTask),this.i3sOverrides=a(this.i3sOverrides),this._elevationProvider&&(this._elevationProvider.notifyObjectsChanged(this.getVisibleObbs()),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._workerHandle;e&&(e.destroyContextAndSelf(this.uid),this._workerHandle=null),this._removeAllNodeDataFromStage(),this._memCache=a(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=a(this._labeler),this._treeDebugger=a(this._treeDebugger),this._controller=a(this._controller),this._highlights=a(this._highlights),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this._crossfadeHelper=a(this._crossfadeHelper),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null),this._updatingHandles=a(this._updatingHandles)}_memEstimateTextureAdded(e){const t=e.usedMemory;return this._gpuMemoryEstimate+=t,this._texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(null!=e){const t=e.usedMemory;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)}get usedMemory(){let e=null!=this._labeler?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach(t=>e+=null!=t?t.node.memory:0),this._nodeId2MetaReloading.forEach(t=>e+=null!=t?t.node.memory:0),e}get unloadedMemory(){return(null!=this._controller?this._controller.unloadedMemoryEstimate:0)+(null!=this._labeler?this._labeler.unloadedMemoryEstimate:0)}_labelingChanged(){if(!(we(this.i3slayer)&&this._supportsLabeling))return void(null!=this._labeler&&(this._labeler.destroy(),this._labeler=null));if(null!=this._labeler)return;const e=new me({view:this.view,layer:this.i3slayer,collection:this._collection,overrides:this.i3sOverrides,layerViewUid:this.uid});this._nodeId2Meta.forEach(t=>null!=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=be().then(()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()}),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=e=>o.getLogger(this).error("set-modifications-error","Error when setting modifications:",e),t=this.uid,i=this.i3slayer.spatialReference,s=i.isGeographic,r=ye(this._layerClippingArea,this._modifications,i);this._workerHandle.setModifications(t,r,s).catch(e);try{ve({context:t,modifications:r,isGeodetic:s})}catch(a){e(a)}this._controller.modificationsChanged();const n=this.hasModifications?new l:null;this._nodeId2Meta.forEach((e,t)=>{null==e?(this._nodeId2Meta.delete(t),this._controller.updateLoadStatus(t,!1)):e.node.hasModifications?(this._updateFeatureIdCounts(e,-1),this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):null!=n&&n.push(e.node)}),this.notifyChange("elevationRange"),null!=n&&this._nodeId2MetaReloading.forEach(e=>n.push(e.node)),null!=n&&n.length>0&&(this.updateNodeModificationStatus(n),n.forAll(e=>{if(2!==e.imModificationImpact){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),null!=t?(this._updateFeatureIdCounts(t,-1),this._nodeId2Meta.delete(e.index),this._nodeId2MetaReloading.set(e.index,t),this.notifyChange("elevationRange")):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(null!=this._modificationGraphics&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!rt.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={outline:{color:[255,255,255],width:1}};this._modificationGraphics=[];for(const s of this._modifications){const r=s.geometry;r.spatialReference=this.i3slayer.spatialReference;const o=new _e({...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))}_contentVisibleChanged(e){e?(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler)):(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);null!=i?.attributeInfo&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);null!=s&&(await this.i3sOverrides.applyAttributeOverrides(s.featureIds,t,i,this._controller.requiredAttributes),s.attributeInfo=t,this._controller.reschedule(()=>{this._nodeId2Meta.get(e)===s&&this._attributeValuesChanged(s)},i).catch(e=>{h(e)||o.getLogger(this).warn("Error while updating attribute values. Layer might not display correctly.",e)}))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.appliedFilters=null,null!=this._labeler&&this._labeler.setNodeMetaAttributes(e,(e,t)=>this._createAttributes(e,t)),this._updateEngineObject(e)}clearMemCache(){null!=this._memCache&&this._memCache.clear(),this._addTasks.forEach(e=>e.allowMemCache=!1)}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach(t=>null!=t&&e.push(t.node)),e}getVisibleObbs(){const e=new Array;return this._nodeId2Meta.forEach(t=>t&&e.push(this._collection.getComponentObb(t.objectHandle))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach((t,i)=>e.push(i)),this._nodeId2MetaReloading.forEach((t,i)=>e.push(i))}_preLoadBasis(){!has("disable-feature:i3s-basis")&&2&this.supportedTextureEncodings&&this.i3slayer.textureSetDefinitions?.some(e=>e.formats.some(e=>"basis"===e.format||"ktx2"===e.format))&&pt()}_getVertexBufferLayout(e,t){return ht(ut(this._getGeometryParameters({hasTexture:Vt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion})))}_getObjectIdField(){return this.i3slayer.objectIdField||se}_getGlobalIdField(){return this.i3slayer.globalIdField}_findGraphicNodeAndIndex(e){const t=et(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());for(const i of this._nodeId2Meta.values()){const e=i?.featureIds.indexOf(t);if(null!=e&&e>=0)return{node:i.node,index:e}}return null}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(null==i)return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const n of t){const e=et(o,n.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 null==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(null==i?.featureIds||t>=i.featureIds.length)return null;const s=i.objectHandle,r=Ee(t,this._collection,s,Y(24),0),o=this.view.renderSpatialReference,n=this.view.spatialReference;return B(r,o,0,r,n,0)?W(r):null}whenGraphicAttributes(e,t){return Ge(this.i3slayer,e,this._getObjectIdField(),t,()=>[...this._nodeId2Meta.values()].filter(r))}getGraphicFromIntersectorTarget(e,t){if(null==e.nodeIndex||null==e.componentIndex)return null;const i=this._nodeId2Meta.get(e.nodeIndex);if(null==i?.featureIds||e.componentIndex>=i.featureIds.length)return null;const s=this._createLayerGraphic(this._createAttributes(e.componentIndex,i));return s?t.defer?(t.defer(async()=>(s.geometry=(await import("./i3s/meshUtils.js")).createMesh({layerView:this,nodeIndex:e.nodeIndex,featureIndex:e.componentIndex}),s)),null):s:null}_getCacheKey(e){return`${this._layerUrl}/v${Mt}/${e}${this._cacheKeySuffix}`}_getCacheKeySuffix(){const e=this.view.renderSpatialReference;if(null==e)return qt;if(e===U(e))return zt;return this.i3slayer.spatialReference.equals(e)?Bt:null!=e.wkid?`@${e.wkid}`:null}_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 null!=this._memCache?this._memCache.pop(this._getMemCacheKey(e)):null}deleteCachedGPUData(e){null!=e&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(null==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,i)}loadMissingTextures(e,t,i,s){const r=e?.filter((e,i)=>{if(0===(e.usage&this.rendererTextureUsage))return!1;if(null==t)return!0;const s=De(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(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.id),t).then(s=>null==s?null:(s.globalTrafo=X(s.globalTrafo),s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e.id)),null):(0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=at.fromData(s.geometryObbData)),this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then(i=>(i&&this._idbCache.initialized&&null!=s.textureData&&(s.byteSize=At(s.transformedGeometry,s.textureData),s.textureData.every(Tt)&&this._indexedDbSizeCheck(e,s)&&this._idbCache.put(this._getCacheKey(e.id),s).catch(t=>o.getLogger(this).warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`))),c(t),s))))):Promise.resolve(null)}addNode(e,t,i){return Dt(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(null==s)return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:n,featureIds:a,anchorIds:l,anchors:d,transformedGeometry:h}=s,c=X(s.globalTrafo),u=O(Ut,r.center.x,r.center.y,r.center.z);j(u,u,c);const _=new at(u,[r.extents.x,r.extents.y,r.extents.z],S(r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w));0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=_),t.geometryData.componentOffsets=n,a&&(t.geometryData.featureIds=Array.from(a)),t.geometryData.anchorIds=l,t.geometryData.anchors=d;const g={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:h,globalTrafo:c,geometryObbData:_.data,byteSize:At(h,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&this._indexedDbSizeCheck(e,g)){const t=null!=g.textureData?g.textureData.map(e=>Tt(e)?e:null):null;this._idbCache.put(this._getCacheKey(e.id),{...g,textureData:t}).catch(t=>o.getLogger(this).warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`))}return this._addCachedNodeData(e,g,i)},i))):Promise.reject()}getElevationRange(e){const t=new ot,i=this._controller,{index:s}=i;if(!s)return t;const{rootNode:r}=s;if(!r)return t;const o=this._nodeId2Meta,n=e.radius,a=i.viewportQueries,l=this._planetRadiusInGlobalMode,{view:d}=this,{renderCoordsHelper:h}=d,c=h.referenceEllipsoid.radius,u=this._collection,_=i=>{const{childrenLoaded:s}=i;if(0===s)return!1;const r=a.getAndUpdateVisibilityObbInRenderSR(i);let d=null,_=-1;if(r){if(_=r.radius,!r.intersectSphereWithMBS(e,_))return!1}else d=a.getServiceMbsInRenderSR(i),d&&(_=d.radius);if(_>=0&&n>=1*_)return null!=r?Kt(t,r,l):null!=d&&d.radius>=0&&Qt(t,d,l),!1;const g=$t;if(g.elevationRangeMin=1/0,g.elevationRangeMax=-1/0,(null!=r||null!=d)&&(null!=r?Kt(g,r,l):null!=d&&Qt(g,d,l),g.elevationRangeMin>=t.elevationRangeMin&&g.elevationRangeMax<=t.elevationRangeMax))return!1;const m=o.get(i.index);if(m){const{geometryObbInRenderSR:s}=i;if(!s||s.intersectSphereWithMBS(e)){if(s){if(n>0*s.radius)return Kt(t,s,l),!1}const{objectHandle:e}=m,i=u.getObjectTransform(e),r=h.getAltitude(i.position);u.expandRangeWithComponentObjectElevationRange(e,r,c,t)}}return s-(m?1:0)>0};return s.traverse(r,_),t}computeVisibilityObb(e){return Be(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications,this.view.renderCoordsHelper.sphericalPCPF)}_transformNode(e,t,i){const s=t.geometryData.geometries??[],r=new Array(s.length);for(let f=0;f<s.length;++f)r[f]=this._getVertexBufferLayout(s[f],t.geometryDescriptor);const o=this.i3slayer.normalReferenceFrame,n=t.normalReferenceFrame??o??"none",a=e.serviceMbsInIndexSR,l=this.elevationOffset,d=this._controller.crsIndex,h=this._controller.crsVertex,c=this.view.renderSpatialReference,u=Pe(a,l,n,d,c),_=q(d,h),g=q(h,c);if(null==_||null==g)return Promise.resolve(null);const m={context:this.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,globalTrafo:u,mbs:a.toJSON(),obbData:e.serviceObbInIndexSR?.data,elevationOffset:l,needNormals:this._controller.isMeshPyramid,normalReferenceFrame:n,indexToVertexProjector:_,vertexToRenderProjector:g};return this._workerHandle.invoke(m,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(0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=this._collection.getComponentObb(t.objectHandle).clone()),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);null!=this._labeler&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,!0),this._updateMaterial(t),this._setNewNodeOpacity(t),0!==this.elevationInfo.mode&&this._ensureElevationTask().schedule(s),this._updateEngineObject(t),this._highlights?.objectCreated(t),null!=this._treeDebugger&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,()=>this._addCachedNodeData(e,t,s))}async deleteCachedNodeData(e){if(this._idbCacheEnabled)return this._idbCache.remove(this._getCacheKey(e))}async _addCachedNodeData(e,t,i){if(!this.contentVisible||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(null==t)return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:n}=t;await this.i3sOverrides.applyAttributeOverrides(r.featureIds,s.attributeInfo,i,this._controller.requiredAttributes);const a=null!=t.textureData?t.textureData.filter(e=>null!=e&&0!==(e.usage&this.rendererTextureUsage)):[];!has("disable-feature:i3s-basis")&&a.some(e=>null!=e&&(2===e.encoding||1===e.encoding))&&await pt(),e.memory=0;const{componentOffsets:l,geometries:d,featureIds:h,anchorIds:c,anchors:u}=r,_=this._collection,g=d[0],{layout:m,indices:f,interleavedVertexData:p,positionData:y,hasColors:b}=n,{material:S,geometryParameters:O}=this._materialParameters(g,m),j=l||new Uint32Array([0,f?f.length:p.byteLength/m[0].stride]),V=new _t({data:p,count:p.byteLength/m[0].stride,layoutParameters:O},{positions:Z(y.data),indices:ee(y.indices)},f,j),D=g.transformation?x(g.transformation):R(),T=X(t.globalTrafo);M(D,T,D);const A=w(H(),D),N=v(C(),D),k=this.view.renderSpatialReference,U=this.view.basemapTerrain.spatialReference,G=at.fromData(lt(t.geometryObbData)).center,B=[1,1,1];L(G,k,B,U)||o.getLogger(this).errorOnce("Unsupported coordinate system for IM overlay");const q=H();z(G,k,q,U);const W=C();I(W,N);const $=H();E($,F($,G,A),W);const K=q[0]-$[0]*B[0],Q=q[1]-$[1]*B[1],J=_.createObject(new ct(P(K,Q,B[0],B[1]),new mt(A,N),at.fromData(lt(t.geometryObbData)),V,!this._isIntegratedMesh)),Y=2===O.textureCoordinateType,{textures:te,texturePromise:ie}=this._initMaterialAndTextures(J,S,a,Y,e);e.memory+=this._memEstimateGeometryAdded(J),e.memory+=te.reduce((e,t)=>e+(null!=t?this._memEstimateTextureAdded(t):0),0);const se=!!S.hasParametersFromSource,re="blend"!==S.alphaMode&&S.metallicRoughness.baseColorFactor[3]>=1,oe=new Ct(e,h,J,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:se,isOpaque:re},te,c,u);s.meta=oe,this._hasTextures||=t.requiredTextures?.some(({usage:e})=>!!(19&e))||!!e.resources.texture,this._hasData=!0,this._hasColors||=b,this.notifyChange("hasTexturesOrVertexColors");const ne=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(oe),ie]).then(([t,s])=>(this._addTasks.has(e.index)&&t?.updateObjectVisibility(oe.objectHandle,!1).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),this._safeReschedule(()=>{const i=this._addTasks.get(e.index);if(!i)return;if(this._addNodeMeta(e.index,oe),i.meta=null,!this.contentVisible)return void this._removeNodeStageData(e.index,this.elevationOffset);_.setObjectVisibility(J,!0),t?.updateObjectVisibility(oe.objectHandle,!0).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),oe.attributeInfo=i.attributeInfo;const s=oe.cachedRendererVersion!==this._rendererVersion,r=ne!==this.slicePlaneEnabled;this._updateElevationOffsets(oe);const o=oe.elevationOffsets;this._updateComponentData(oe);const n=this._applyFiltersToNode(oe);(s||null!=t&&(r||n||o))&&this._addOrUpdateEdgeRendering(oe),null!=this._labeler&&this._addMetaToLabeler(this._labeler,oe),this._visibleGeometryChanged(oe,0),this._highlights?.objectCreated(oe),this._updateMaterial(oe),this._setNewNodeOpacity(oe),null!=this._treeDebugger&&this._treeDebugger.update()},i))).catch(e=>{const{meta:t,allowMemCache:i}=s;throw s.meta=null,t&&i?this._cacheGPUData(t):t&&this._deleteComponentObject(t),e})}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){o.getLogger(this).error("Removing duplicated node");const t=this._nodeId2Meta.get(e);t&&(this._deleteComponentObject(t),this._updateFeatureIdCounts(t,-1))}else this._controller.updateLoadStatus(e,!0);t&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Pt(t.cachedEdgeMaterials,0),this._updateFeatureIdCounts(t,1)),this._nodeId2Meta.set(e,t),this.notifyChange("elevationRange")}_updateElevationOffsets(e){if(!e.node.serviceMbsInIndexSR)return;const t=this.view.renderSpatialReference,i=this._controller.crsIndex,s=this.elevationInfo,r=this.view.basemapTerrain,o=r.spatialReference,n=s.mode;if(null==t||null==o||0===n)return void(e.elevationOffsets=null);const a=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const l=Ut,d=Lt,h=2===n,c=this.view.renderCoordsHelper,u=e.featureIds.length,_=(()=>{if(e.cachedElevationAnchors)return e.cachedElevationAnchors;const s=Y(3*u);e.cachedElevationAnchors=s;for(let r=0;r<u;r++){const n=3*r,h=e.anchorIds?.indexOf(r)??-1;e.anchors&&h>=0?(O(l,e.anchors[3*h],e.anchors[3*h+1],e.anchors[3*h+2]),V(l,l,e.node.serviceMbsInIndexSR.center),z(l,i,l,o),s[n]=l[0],s[n+1]=l[1],s[n+2]=c.getAltitude(l)):(this._collection.getComponentAabb(e.objectHandle,r,d,!0),O(l,(d[0]+d[3])/2,(d[1]+d[4])/2,d[2]),E(l,l,a.rotationScale),V(l,l,a.position),s[n+2]=c.getAltitude(l),z(l,t,l,o),s[n]=l[0],s[n+1]=l[1])}return s})(),g=s.offset,m=e.elevationOffsets,f=(e,t)=>{const i=h?_[3*e+2]:0;m[e]=g+(t??0)-i};r.getElevations(_,u,f)}_ensureElevationTask(){return null!=this._elevationTask||(this._elevationTask=new Re(this.view.resourceController.scheduler,e=>this._controller.updateElevationChanged(e,this.view.basemapTerrain.spatialReference)?.filterInPlace(e=>null!=this._nodeId2Meta.get(e)),e=>this._nodeElevationAlignmentChanged(this._nodeId2Meta.get(e)),()=>this.elevationInfo?.mode)),this._elevationTask}_elevationInfoChanged(e,t){const i=0!==e.mode,s=!!t&&t!==e&&0!==t.mode;this._intersectionHandler.updateElevationAlignState(i,this.view.state.viewingMode),i&&!s&&this._controller.removeAllGeometryObbs(),this._nodeId2Meta.forEach(e=>this._nodeElevationAlignmentChanged(e))}_nodeElevationAlignmentChanged(e){null!=e&&(this._updateElevationOffsets(e),this._updateComponentData(e),this._updateEdgeRendering(e),null!=this._labeler&&this._labeler.updateLabelPositions(e),this._updateSnappingSources(e,2),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e.objectHandle)))}_safeReschedule(e,t){return c(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=null!=e.params.material?e.params.material:Te(),s=t.some(e=>"uvRegion"===e.name),r=t.some(e=>"normalCompressed"===e.name),o=Vt(i);return{geometryParameters:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s,r){const o=this._stage.renderView,n=e=>{this._gpuMemoryEstimate-=e,this._texMemoryEstimate-=e,r.memory-=e},a=i.map(e=>Ae(e,t,s,o,this._compressionTracker,n));this._stage.addTextures(a);let l=null;return this._collection.updateMaterial(e,e=>{l=He(e,t,a,i,this.view.stage.renderView.textures,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)}),{textures:a,texturePromise:l}}_getGeometryParameters(e){return new gt(this._hasVertexColors,e.hasTexture?e.hasRegions?2:1:0,e.hasNormals,this._shadeNormals,this._applySSAO)}_addData(e,t,i){let s=this._addTasks.get(e.index);if(s)s.attributeInfo=t;else{const r=u();s=new Nt(t,null,r.promise),this._addTasks.set(e.index,s),i().then(r.resolve,r.reject).then(()=>this._addTasks.delete(e.index)).catch(t=>{throw this._addTasks.delete(e.index),t})}return s.promise}_clearAddTasks(){this._addTasks.forEach(e=>{null!=e.meta&&(this._cacheGPUData(e.meta),e.meta=null)}),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=Q();this._renderClippingArea=nt(this.view.clippingArea,i,e)?i:null;const s=Q();this._layerClippingArea=nt(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),this._assertFeatureIdNodeCounts(e)}_assertFeatureIdNodeCounts(e){e&&!this._featureIdCounts?(this._featureIdCounts=Zt(this._nodeId2Meta.values()),this._filteredIdCounts=Zt(this._nodeId2Meta.values(),1),this._weaklyRemovedIdCounts=Zt(this._nodeId2Meta.values(),2),this.addHandles(g(()=>this._controller.updating,e=>{!e&&this._needFilterResolve&&(this.multiGeometryFilterResolve(),this._needFilterResolve=!1,this.notifyUpdate())},{sync:!0}),"updateFinished")):!e&&this._featureIdCounts&&(this._featureIdCounts=null,this._filteredIdCounts=null,this._weaklyRemovedIdCounts=null,this._mismatchShow=null,this._mismatchHide=null,this.removeHandles("updateFinished"),this._needFilterResolve=!1,this.notifyUpdate())}_updateFeatureIdCounts(e,t){this._featureIdCounts&&(this._needFilterResolve=!0,Xt(this._featureIdCounts,e.featureIds,t),Xt(this._filteredIdCounts,e.filteredIds,t),Xt(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,t))}_updateFilteredIdCounts(e,t,i){this._filteredIdCounts&&(this._needFilterResolve=!0,Xt(this._filteredIdCounts,t,-1),Xt(this._filteredIdCounts,e.filteredIds,1),Xt(this._weaklyRemovedIdCounts,i,-1),Xt(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,1))}_checkFeatureIdNodeCountInvariant(){const e=null!=this._featureIdCounts;if(this.hasGeometryFilter!==e&&o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","LayerView should have feature id node counts if and only if it has a geometry filter",{layerView:this,hasNodeCounts:e}),!this._featureIdCounts||!this._filteredIdCounts)return;const t=Zt(this._nodeId2Meta.values());n(this._featureIdCounts,t)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _featureIdCounts",{layerView:this,counts:this._featureIdCounts,expected:t});const i=Zt(this._nodeId2Meta.values(),1);n(this._filteredIdCounts,i)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _filteredIdCounts",{layerView:this,counts:this._filteredIdCounts,expected:i});const s=Zt(this._nodeId2Meta.values(),2);n(this._weaklyRemovedIdCounts,s)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _weaklyRemovedIdCounts",{layerView:this,counts:this._weaklyRemovedIdCounts,expected:i})}multiGeometryFilterResolve(){if(!this._featureIdCounts||!this._filteredIdCounts)return;let e=null,t=null;for(const[i,s]of this._filteredIdCounts){const r=this._featureIdCounts.get(i);if(r!==s){s+(this._weaklyRemovedIdCounts?.get(i)??0)===r?(e??=new Set,e.add(i)):(t??=new Set,t.add(i))}}f(e,this._mismatchShow)&&f(t,this._mismatchHide)||(this._mismatchShow=e,this._mismatchHide=t,this._nodeId2Meta.forEach(e=>{if(!e?.filteredIds)return;const t=Yt(e,this._mismatchShow,this._mismatchHide);this._collection.setAllComponentVisibilities(e.objectHandle,t),this._visibleGeometryChanged(e,2)}))}_filterChange(){this._applyFilters(this.hasGeometryFilter)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach(e=>{e&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,2))})}getFilters(){const e=[],t=this._renderClippingArea;return null!=t&&e.push((e,i)=>this._boundingRectFilter(e,i,t)),e}addSqlFilter(e,t,i){if(null!=t){const s=t.fieldNames;e.push((e,r)=>this._sqlFilter(e,r,t,s,i))}}_sqlFilter(e,t,i,s,r){const o={},n=this._createLayerGraphic(o);if(!n)return;const a=this.i3slayer.objectIdField,l=t.featureIds,d=t.attributeInfo?.attributeData;s.every(e=>e===a||null!=d?.[e])&&qe(e,l,e=>{o[a]=l[e];for(const i of s)i!==a&&(o[i]=d?Se(d[i],e):null);try{return i.testFeature(n)}catch(t){return r(t),!1}})}_boundingRectNodeTest(e,t){return G(e.node.serviceMbsInIndexSR,this._controller.crsIndex,Ft,this.view.renderSpatialReference),ze(t,Ft)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,Rt),K(Rt,St),J(i,St)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(3===r)return;if(0===r)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const n=this._transformClippingArea(Ot,i,t.objectHandle);qe(e,t.featureIds,e=>this._boundingRectFeatureTest(t,e,n))}_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}async _addOrUpdateEdgeRendering(e,t=!0){const i=e.objectHandle,{hasEdges:s,perFeatureEdgeMaterials:r}=this._getFilteredEdgeMaterials(e);s&&!this._edgeView&&(this._edgeView=await this._stage.renderer.loadEdgeView());const o=this._edgeView;if(!o)return null;const n=o.hasObject(i);if(s){if(n){if(this.nodeCrossfadingEnabled){Pt(r,this.getNodeOpacity(e))}return o.updateAllComponentMaterials(i,r,this.slicePlaneEnabled,t).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),o.updateObjectVisibility(i,!0).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),o.updateAllVerticalOffsets(i,e.elevationOffsets).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),o}const s=await this._collection.addEdges(i,o,r,this.slicePlaneEnabled,e.elevationOffsets);return e.edgeMemoryUsage=s,e.node.memory+=s,o}return n&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,o.removeObject(i)),null}_applyFiltersToNode(e){const{filteredIds:t,weaklyRemovedIds:i}=e,s=this._applyFiltersToNodeComponents(e);return this._updateFilteredIdCounts(e,t,i),s&&this._labeler?.applyFilterChange(e),s}_applyFiltersToNodeComponents(e){const t=this._collection,i=t.getComponentCount(e.objectHandle),s=null!=e.filteredIds,r=0===i.invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!r;if(null!=e.filteredIds&&e.appliedFilters===this._filters||(e.weaklyRemovedIds=null,e.filteredIds=Jt(e,this._filters),e.appliedFilters=this._filters),s&&e.filteredIds===e.featureIds&&(!this._mismatchHide||e.filteredIds.every(e=>!this._mismatchHide?.has(e))))return!r;const o=Yt(e,this._mismatchShow,this._mismatchHide);return t.setAllComponentVisibilities(e.objectHandle,o),!0}_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=a(this._elevationTask)}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading),null!=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);null!=s?(this._collection.setObjectVisibility(s.objectHandle,!1),null!=this._edgeView&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),this._visibleGeometryChanged(s,1),null!=this._labeler&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights?.objectDeleted(s),i===this._nodeId2Meta?(this._updateFeatureIdCounts(s,-1),this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),null!=this._treeDebugger&&this._treeDebugger.update()):i.delete(e)}_deleteComponentObject(e){if(null!=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.removeTexture(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._collection.updateMaterial(i.objectHandle,e=>e.polygonOffsetEnabled=0===t)}updateNodeIndex(e,t){if(this._nodeId2Meta.has(e)){const i=this._nodeId2Meta.get(e);this._nodeId2Meta.delete(e),this._nodeId2Meta.set(t,i),this.notifyChange("elevationRange")}const i=this._nodeId2MetaReloading.get(e);i&&(this._nodeId2MetaReloading.delete(e),this._nodeId2MetaReloading.set(t,i))}_invalidateAllSymbols(){this._rendererVersion=We(this._rendererVersion,1),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 ce()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:o.getLogger(this).warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.symbols)"mesh-3d"!==t.type&&o.getLogger(this).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=i*e.cachedSymbologyStride;N(s.externalColor,t[r]/255,t[r+1]/255,t[r+2]/255,t[r+3]/255);const o=this._stage.renderView.olidRenderHelper;if(o){const t=e.featureIds[i],r=this.sublayerId?`${this.layerViewUid}_${this.sublayerId}`:this.layerViewUid,n=de(this.view,this.uid);o.setUidToObjectAndLayerId(t,t,this.layerId,r,this.layerPopupEnabledAndHasTemplate&&!n,e.node.resources.attributes,i,this.sublayerId),s.olidColor=o.getObjectAndLayerIdColor({graphicUid:t,layerViewUid:r})}s.externalColorMixMode=15&t[r+4],s.castShadows=!!(16&t[r+4]),s.pickable=!!(32&t[r+4]),s.elevationOffset=e.elevationOffsets?.[i]??0,s.emissiveStrength=e.emissiveStrengths?.[i]??1,s.emissiveSource=e.emissiveSources?.[i]??0}}_getSymbolInfo(e,t){const i=e?.getSymbol(t,{arcade:this._arcade});if(!(i instanceof ue))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=null!=this._symbologyOverrideFields&&this._symbologyOverrideFields.length>0?null!=this._rendererFields&&this._rendererFields.length>0?oe(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=e.attributeInfo?.attributeData,o=e.featureIds?this.i3slayer.objectIdField:null,n=null!=r&&null!=this._symbologyFields&&this._symbologyFields.length>0;let a=null,l=null;if(n&&null!=this._symbologyFields){a=[],l=[];for(const e of this._symbologyFields){const t=r[e];t&&(a.push(e),l.push(t))}}e.cachedSymbology||(e.cachedSymbology=ie(e.featureIds.length*e.cachedSymbologyStride));const d=new Ze,h=this.fullOpacity,c=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let u=null,_=1,g=Ke,m=0;for(let f=0;f<e.featureIds.length;f++){if(null!=o&&(i[o]=e.featureIds[f]),n&&a)for(let e=0;e<a.length;e++)i[a[e]]=Se(l[e],f);const r=s?this._getSymbolInfo(s,t):null;let h,p;if(d.pickable=!0,s&&"visualVariables"in s){if(this._colorVariable){const e=ae(this._colorVariable,t,{color:Et,arcade:this._arcade});e&&(h=d.color,h[0]=e.r/255,h[1]=e.g/255,h[2]=e.b/255,h[3]=e.a??1,this._opacityVariable||null===e.a||(p=e.a))}this._opacityVariable&&(p=le(this._opacityVariable,t,{arcade:this._arcade}))}if(r?.material){const e=r.material;h=null==h||null==p?Me(h,p,e.color,e.alpha,It,d.color):Me(h,p,null,null,It,d.color)}h??=N(d.color,1,1,1,1);const y=r?.material;if(d.colorMixMode=y?.colorMixMode??1,d.edgeMaterial=r?.edgeMaterial,this._symbologyOverride?.(t,d),null!=this._nodeColorOverride&&(this._nodeColorOverride(e.node,h),d.colorMixMode=3),d.pickable&&=h[3]>=vt,d.castShadows=r?r.castShadows:d.pickable,null!=d.edgeMaterial){const t=h[3]>=1&&(e.material.isOpaque||3===d.colorMixMode)?1:0;d.edgeMaterial===u&&t===_||(g={...d.edgeMaterial,opacity:c,objectTransparency:t},u=d.edgeMaterial,_=t),e.cachedEdgeMaterials[f]=g}else e.cachedEdgeMaterials[f]=Ke;e.cachedSymbology[m++]=Math.round(255*h[0]),e.cachedSymbology[m++]=Math.round(255*h[1]),e.cachedSymbology[m++]=Math.round(255*h[2]),e.cachedSymbology[m++]=Math.round(255*h[3]),e.cachedSymbology[m++]=d.colorMixMode|+d.castShadows<<4|+d.pickable<<5;const b=y?.emissive?.strength??ft;b===ft||e.emissiveStrengths||(e.emissiveStrengths=new Array(e.featureIds.length).fill(ft)),e.emissiveStrengths&&(e.emissiveStrengths[f]=b);const v=y?.emissive?.source||0;0===v||e.emissiveSources||(e.emissiveSources=new Array(e.featureIds.length).fill(0)),e.emissiveSources&&(e.emissiveSources[f]=v)}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);this.nodeCrossfadingEnabled||Pt(t,this.fullOpacity);const i=e.filteredIds;if(null==i){return{hasEdges:t.some(e=>e!==Ke),perFeatureEdgeMaterials:t}}let s=0,r=!1;const o=t.map((t,o)=>e.featureIds[o]!==i[s]?Ke:(r=r||t!==Ke,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=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,t=>t.objectOpacity=e),Pt(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,2)}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),null!=this._labeler&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach(t=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,t=>t.commonMaterialParameters.hasSlicePlane=e),this._updateEdgeRendering(t,!1))})}_updatePBR(e){this._nodeId2Meta.forEach(t=>{null!=t&&this._collection.updateMaterial(t.objectHandle,t=>t.usePBR=e)}),this._hasLoadedPBRTextures=!0}get _usePBR(){return this._shadeNormals&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){null!=this._edgeView&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_ignoreClientNodeOverriddenFeatures(e){return this.i3sOverrides.hasGeometryChanges?(t,i,s)=>s.node.index>=0&&this.i3sOverrides.featureHasGeometryChanges(t)?0:e(t,i,s):e}_forAllFeatures(e,t,i){for(const s of this._nodeId2Meta.values())if(!(null==s||t&&s.node.serviceMbsInIndexSR&&1===t(s.node.serviceMbsInIndexSR)))switch(i){case 1:this._forAllFeaturesOfNode(s,e);break;case 0:this._forAllVisibleFeaturesOfNode(s,e);break;case 2:this._forAllQueryableFeaturesOfNode(s,e)}}_forAllFeaturesOfNode(e,t){e.featureIds.forEach((i,s)=>t(i,s,e))}_forAllVisibleFeaturesOfNode(e,t){const i=e.featureIds;this._collection.forEachVisibleComponent(e.objectHandle,s=>0===t(i[s],s,e))}_forAllQueryableFeaturesOfNode(e,t){const i=this._ignoreClientNodeOverriddenFeatures(t);if(null==this._renderClippingArea)return this._forAllFeaturesOfNode(e,i);const s=this._boundingRectNodeTest(e,this._renderClippingArea);if(0===s)return;if(3===s)return this._forAllFeaturesOfNode(e,i);const r=e.featureIds,o=e.objectHandle,n=Qe(this._renderClippingArea,this._collection.getObjectTransform(o));for(let a=0;a<r.length;a++)this._boundingRectFeatureTest(e,a,n)&&i(r[a],a,e)}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=t.attributeInfo?.attributeData;if(null!=s)for(const r of Object.keys(s))i[r]=Se(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e,t){const s=tt(e);if(0===s.length)return it;const r=yt(t),o=s[0]instanceof i?this._featureIdsFromGraphics(s):"number"==typeof s[0]?s:null;if(!o)return it;const n=this._ensureHighlights(),{set:a,handle:l}=n.acquireSet(r);return n.setFeatureIds(a,o),l}_featureIdsFromGraphics(e){const t=this.i3slayer.fieldsIndex,i=this._getObjectIdField();return e.map(e=>et(t,e.attributes,i))}_ensureHighlights(){return this._highlights??=new xe({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,1),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._highlights}resetHighlights(){this._highlights=a(this._highlights)}_visibleGeometryChanged(e,t){this._elevationProvider&&(null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=m(()=>{const{node:t}=e,i=t.visibilityObbInRenderSR??t.geometryObbInRenderSR??t.serviceObbInRenderSR;if(null!=i){const e=$();i.toAaBoundingBox(e),this.emit("visible-geometry-changed",new ge(e))}else this.emit("visible-geometry-changed");this._visibleGeometryChangedSchedulerHandle=null})),this._updateSnappingSources(e,t),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e.objectHandle)))}get performanceInfo(){return new fe(this.usedMemory,this._nodeId2Meta.size,Math.round(this._gpuMemoryEstimate/1048576),Math.round(this._geoMemoryEstimate/1048576),Math.round(this._texMemoryEstimate/1048576),Math.round(this.unloadedMemory/1048576),this._idbCacheEnabled?Math.round(100*this._idbCache.getHitRate()):0)}checkInvariants(){}get test(){}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return null!=e?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}getNodeComponentHandle(e){return this._nodeId2Meta.get(e)?.objectHandle}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(e)}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);null!=s&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);null!=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(null==this._edgeView||!e.cachedEdgeMaterials)return;Pt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t).catch(e=>this._logEdgeViewError(e,this.i3slayer.title))}get hasModifications(){return this._isIntegratedMesh&&null!=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=Ht(e);if(s){const t={context:i,buffer:s.buffer};Ie(t);const r=new Float64Array(s.buffer);e.forAll((e,t)=>{const i=r[t],s=Ce(i);e.imModificationImpact=s,0!==s&&this._controller.invalidateGeometryVisibility(e.index)})}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||null!=this._labeler&&this._labeler.updating||this._crossfadeHelper?.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0||null!=this._elevationTask&&this._elevationTask.readyToRun||this._needFilterResolve||this._compressionTracker.compressing}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(null==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(null==t)return;const s=this._controller.getRenderMbs(t.node);s&&e.add(i,s)}),t}_snappingLocationsApplyElevation(e,t,i){if(!e.elevationOffsets||0===this.elevationInfo.mode)return;const s=t.position0,r=t.position1,o=t.componentIndex,n=H(),a=H(),l=(e,t)=>{V(e,e,i),this.view.renderCoordsHelper.worldUpAtPosition(e,a),V(e,e,D(a,a,t)),T(e,e,i)};for(let d=0;d<s.count;d++){const t=e.elevationOffsets[o.get(d)];s.getVec(d,n),l(n,t),s.setVec(d,n),r.getVec(d,n),l(n,t),r.setVec(d,n)}}_updateSnappingSources(e,t){const{index:i}=e.node,s=this._controller.getRenderMbs(e.node);if(null!=s)for(const r of this._snappingSourcesTrackers)1!==t&&2!==t||r.events.remove(i),0!==t&&2!==t||r.events.add(i,s)}_logEdgeViewError(e,t){h(e)||o.getLogger(this).warn("Error while processing edges. Edges on this layer might not display correctly",t,e)}_indexedDbSizeCheck(e,t){return t.byteSize>wt?(o.getLogger(this).warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}get elevationProvider(){return this._elevationProvider}};return e([y()],A.prototype,"_hasLoadedPBRTextures",void 0),e([y()],A.prototype,"_asyncModuleLoading",void 0),e([y()],A.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([y()],A.prototype,"view",void 0),e([y()],A.prototype,"i3slayer",void 0),e([y()],A.prototype,"_controller",void 0),e([y()],A.prototype,"_labeler",void 0),e([y()],A.prototype,"updating",void 0),e([y()],A.prototype,"suspended",void 0),e([y()],A.prototype,"contentVisible",null),e([y({readOnly:!0})],A.prototype,"legendEnabled",null),e([y(dt)],A.prototype,"updatingProgress",void 0),e([y()],A.prototype,"updatingProgressValue",null),e([y()],A.prototype,"hasTexturesOrVertexColors",null),e([y()],A.prototype,"rendererTextureUsage",null),e([y()],A.prototype,"elevationOffset",null),e([y()],A.prototype,"elevationInfo",null),e([y({type:Boolean})],A.prototype,"slicePlaneEnabled",void 0),e([y()],A.prototype,"supportedTextureEncodings",null),e([y({type:[ne]})],A.prototype,"_modifications",void 0),e([y({readOnly:!0})],A.prototype,"clientGeometry",null),e([y()],A.prototype,"elevationRange",null),e([y()],A.prototype,"fullExtent",null),e([y()],A.prototype,"_elevationTask",void 0),e([y({readOnly:!0})],A.prototype,"_usePBR",null),A=e([b("esri.views.3d.layers.I3SMeshView3D")],A),A},Rt=$(),St=Q(),Ot=Q(),jt=new at,Et=new t([0,0,0,0]),Ft=new te(0,0,0,0);function Vt(e){if(null==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 Dt(e){return"geometryData"in e}function Tt(e){return null!=e&&p(e.data)}function At(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(null!=t)for(const s of t)null!=s&&p(s.data)&&(i+=s.data.byteLength);return i}function Ht(e){if(0===e.length)return;const t=10*e.length,i=new Float64Array(t);let s=0;return e.forAll(e=>{let t=e.serviceObbInIndexSR;null==t&&(t=jt,e.serviceMbsInIndexSR?(t.center=e.serviceMbsInIndexSR.center,t.halfSize=[e.serviceMbsInIndexSR.radius,e.serviceMbsInIndexSR.radius,e.serviceMbsInIndexSR.radius]):t.invalidate());const r=t.data;i[s++]=r[0],i[s++]=r[1],i[s++]=r[2],i[s++]=r[3],i[s++]=r[4],i[s++]=r[5],i[s++]=r[6],i[s++]=r[7],i[s++]=r[8],i[s++]=r[9]}),i}class Nt{constructor(e,t,i){this.attributeInfo=e,this.meta=t,this.promise=i,this.allowMemCache=!0}}function Pt(e,t){e.forEach(e=>e.opacity=t)}class kt{constructor(e,t){this.mode=e,this.offset=t}}const Ut=H(),Lt=$(),Gt="elevation-change",Bt="",qt="@null",zt="@ECEF",Wt=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],$t=new ot;function Kt(e,t,i){let s=e.elevationRangeMin,r=e.elevationRangeMax;const o=i;if(o>0){t.getCorners(Wt);for(const e of Wt){const t=A(e)-o;s=Math.min(s,t),r=Math.max(r,t)}}else{t.getCorners(Wt);for(const e of Wt){const t=e[2];s=Math.min(s,t),r=Math.max(r,t)}}e.expandElevationRangeValues(s,r)}function Qt(e,t,i){const{center:s,radius:r}=t,o=i>0?A(s)-i:s[2];e.expandElevationRangeValues(o-r,o+r)}function Jt(e,t){const i=e.featureIds.slice();for(const s of t)if(s(i,e),0===i.length)break;return i.length===e.featureIds.length?e.featureIds:i}function Yt(e,t,i){const s=new Array,r=e.filteredIds;if(null==r||t?.size||i?.size){if(null!=r){let o=0;e.featureIds.forEach((e,n)=>{if(r[o]===e)++o;else if(!t?.has(e))return;i?.has(e)||s.push(n)})}}else e.featureIds.forEach((e,t)=>{r[s.length]===e&&s.push(t)});return s}function Xt(e,t,i){if(e&&t)for(const s of t){const t=(e.get(s)??0)+i;t>0?e.set(s,t):e.delete(s)}}function Zt(e,t=0){const i=new Map;for(const s of e){Xt(i,0===t?s?.featureIds:1===t?s?.filteredIds:s?.weaklyRemovedIds,1)}return i}export{xt as I3SMeshView3D};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../Color.js";import i from"../../../Graphic.js";import{removeUnordered as s,isSome as r}from"../../../core/arrayUtils.js";import has from"../../../core/has.js";import o from"../../../core/Logger.js";import{equals as n}from"../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../core/maybe.js";import l from"../../../core/PooledArray.js";import{ignoreAbortErrors as d,isAbortError as h,throwIfAborted as c,createResolver as u}from"../../../core/promiseUtils.js";import{initial as _,watch as g}from"../../../core/reactiveUtils.js";import{schedule as m}from"../../../core/scheduling.js";import{equals as f}from"../../../core/SetUtils.js";import{isArrayBuffer as p}from"../../../core/typedArrayUtil.js";import{property as y,subclass as b}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as v,invert as I}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as C}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as M,getTranslation as w}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{clone as x,create as R}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as S}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{h as O,p as j,t as E,a as F,i as V,j as D,e as A,H as T}from"../../../chunks/vec32.js";import{create as H}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as N}from"../../../chunks/vec42.js";import{fromValues as P}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as k}from"../../../core/support/UpdatingHandles.js";import{getSphericalPCPF as U}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{localLinearScaleFactors as L}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectBoundingSphere as G}from"../../../geometry/projection/projectBoundingSphere.js";import{projectBuffer as B}from"../../../geometry/projection/projectBuffer.js";import{getProjectorName as q}from"../../../geometry/projection/projectors.js";import{projectVectorToVector as z}from"../../../geometry/projection/projectVectorToVector.js";import{fromBuffer as W,create as $,toRect as K}from"../../../geometry/support/aaBoundingBox.js";import{create as Q,intersects as J}from"../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as Y,ensurePackedMat4f64 as X}from"../../../geometry/support/DoubleArray.js";import{compactFloatArray as Z}from"../../../geometry/support/FloatArray.js";import{compactIndices as ee}from"../../../geometry/support/Indices.js";import{Sphere as te}from"../../../geometry/support/sphere.js";import{newUByteArray as ie}from"../../../geometry/support/UByteArray.js";import{fallbackObjectIDAttribute as se}from"../../../layers/LayerConstants.js";import re from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as oe}from"../../../layers/support/fieldUtils.js";import ne from"../../../layers/support/SceneModification.js";import{getColor as ae,getOpacity as le}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{isBasemapLayerView as de}from"../../../support/basemapUtils.js";import{getElevationOffset as he}from"../../../support/elevationInfoUtils.js";import{loadArcade as ce}from"../../../support/loadArcade.js";import ue from"../../../symbols/MeshSymbol3D.js";import _e from"../../../symbols/SimpleFillSymbol.js";import{ContentGeometryUpdateEvent as ge}from"./ContentGeometryLayerView.js";import me from"./I3SMeshViewLabeler.js";import{I3SMeshViewPerformanceInfo as fe}from"./I3SMeshViewPerformanceInfo.js";import{I3SMeshWorkerHandle as pe,toWasmModification as ye}from"./I3SMeshWorkerHandle.js";import{initialize as be,setModificationsSync as ve,filterObbsForModificationsSync as Ie,interpretObbModificationResults as Ce}from"./SceneLayerWorker.js";import{overrideColor as Me}from"./graphics/graphicUtils.js";import{areLabelsVisible as we}from"./graphics/Labeler.js";import xe from"./i3s/Highlights.js";import{I3SAsyncElevationUpdater as Re}from"./i3s/I3SAsyncElevationUpdater.js";import{getCachedAttributeValue as Se}from"./i3s/I3SBinaryReader.js";import{I3SCrossfadeHelper as Oe,NodeCrossfadeMetaData as je}from"./i3s/I3SCrossfadeHelper.js";import{boundingBoxCornerPoints as Ee}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Fe}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as Ve,selectEncoding as De,defaultMaterial as Ae,createTexture as Te,configureMaterial as He}from"./i3s/I3SMaterialUtil.js";import{I3SOverrides as Ne}from"./i3s/I3SOverrides.js";import{computeGlobalTransformation as Pe}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as ke,checkSceneLayerValid as Ue,checkSceneLayerCompatibleWithView as Le,whenGraphicAttributes as Ge,computeVisibilityObb as Be,filterInPlace as qe,intersectBoundingRectWithMbs as ze,addWraparound as We,getSymbolInfo as $e,transparentEdgeMaterial as Ke,getClipRect as Qe}from"./i3s/I3SUtil.js";import{IDBCache as Je}from"./i3s/IDBCache.js";import{IDBMockCache as Ye}from"./i3s/IDBMockCache.js";import{LayerElevationProvider as Xe}from"./i3s/LayerElevationProvider.js";import{SymbologyInfo as Ze}from"./i3s/SymbologyInfo.js";import{attributeLookup as et}from"./support/attributeUtils.js";import{normalizeHighlightTarget as tt,emptyHighlightHandle as it}from"./support/highlightUtils.js";import{makeScheduleFunction as st}from"./support/makeScheduleFunction.js";import{debugFlags as rt}from"../support/debugFlags.js";import{ElevationRange as ot}from"../support/ElevationRange.js";import{toBoundingRect as nt}from"../support/extentUtils.js";import{Obb as at,ensurePackedObbData as lt}from"../support/orientedBoundingBox.js";import{updatingProgress as dt}from"../support/updatingProperties.js";import{glLayout as ht}from"../support/buffer/glUtil.js";import{ObjectParameters as ct}from"../webgl-engine/collections/Component/ObjectParameters.js";import{createVertexBufferLayout as ut,SourceGeometry as _t,GeometryParameters as gt}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as mt}from"../webgl-engine/collections/Component/Transform.js";import{emissiveStrengthDefault as ft}from"../webgl-engine/core/shaderLibrary/output/Emissions.glsl.js";import{loadBasisTranscoder as pt}from"../webgl-engine/lib/BasisUtil.js";import{getHighlightName as yt}from"../../support/highlightOptionsUtils.js";import{TextureCompressionTracker as bt}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as vt}from"../../../webscene/support/AlphaCutoff.js";const It=[1,1,1,1];class Ct extends je{constructor(e,t,i,s,r,o,n,a,l){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=n,this.anchorIds=a,this.anchors=l,this.cachedElevationAnchors=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbologyStride=5}get usedMemory(){return this.node.memory}get featureExtents(){return this._featureExtents??=new Float64Array(6*this.featureIds.length).fill(Number.POSITIVE_INFINITY),this._featureExtents}}const Mt=26,wt=104857600,xt=t=>{const p=t;let T=class extends p{constructor(){super(...arguments),this._applySSAO=!0,this._shadeNormals=!0,this._updatingHandles=new k,this._highlights=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._compressionTracker=new bt,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._hasComponentData=!1,this._hasVertexColors=!1,this._nodeColorOverride=null,this.updating=!0,this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.slicePlaneEnabled=!1,this._modifications=new Array,this.ignoresMemoryFactor=!1,this._layerUrl="",this._cacheKeySuffix=null,this._planetRadiusInGlobalMode=0,this._elevationTask=null,this._needFilterResolve=!1,this._filters=[],this._arcade=null,this._tmpAttributeOnlyGraphic=new i,this._crossfadeHelper=new Oe(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerViewUid(){return this.uid}get layerId(){return this.i3slayer.id}get sublayerId(){return null}get _isIntegratedMesh(){return"integrated-mesh"===this.i3slayer.type}get contentVisible(){return!this.suspended&&this._controller?.rootNodeVisible&&this.fullOpacity>vt}get legendEnabled(){return this.contentVisible&&!0===this.i3slayer?.legendEnabled}get updatingProgressValue(){return this._controller?.updatingProgress??0}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return ke(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?63:37:this._usePBR||this._hasLoadedPBRTextures?44:36}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;return null!=e&&"absolute-height"===e.mode?he(e,this.i3slayer.spatialReference):0}get elevationInfo(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null==e)return new kt(0,0);const t=he(e,this.i3slayer.spatialReference);switch(e.mode){case"absolute-height":return new kt(0,t);case"relative-to-ground":return new kt(1,t);case"on-the-ground":return new kt(2,0);default:return new kt(0,0)}}get supportedTextureEncodings(){return Ve(this.view.stage.renderView.capabilities)}get clientGeometry(){return this.i3sOverrides.geometryOverrides}get elevationRange(){const e=this._nodeId2Meta,t=new ot;for(const i of e.values()){const e=i?.node.serviceMbsInIndexSR;e&&t.expandElevationRangeValues(e.center[2]-e.radius,e.center[2]+e.radius)}return t.elevationRangeValid?t:null}get fullExtent(){return this.i3slayer.fullExtent}initialize(){const e=has("enable-feature:idb-mock-cache");this._idbCache=e?new Ye(this.view,e):new Je("esri-scenelayer-cache","geometries"),this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const t=this.view.resourceController,i=t.memoryController;this.i3sOverrides=new Ne({view:this.view,layer:this.i3slayer,memoryController:i}),this._workerHandle=new pe(st(t)),this.addResolvingPromise(this._workerHandle.promise);const s=this.i3slayer.store;this.addResolvingPromise(this._workerHandle.setLegacySchema(this.uid,s.defaultGeometrySchema).catch(d)),Ue(this.i3slayer),Le(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new re({layerView:this,worker:this._workerHandle}),this._gpuMemoryEstimate=0,this._texMemoryEstimate=0,this._geoMemoryEstimate=0,this._stage=this.view.stage,this._collection=this._stage.renderView.componentObjectCollection;const r=s.defaultGeometrySchema;if(this._isIntegratedMesh||!r)this._hasComponentData=!1;else{const e=r.featureAttributes;this._hasComponentData=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=(r?.vertexAttributes.color??null)&&!this.i3slayer.cachedDrawingInfo?.color;const n=this.view.resourceController.memoryController.newCache(`sl-${this.uid}`,e=>this._deleteComponentObject(e));this._memCache=n;const l=this._controller,h=this._nodeId2Meta,c=this._nodeId2MetaReloading,u=e=>{const t=l.index;if(!t)return;const i=t.rootNode;if(!i)return;const s=t=>{const i=t.index,s=h.get(i)||c.get(i);return e(t,s?.objectHandle??null)};t.traverse(i,s)};this._intersectionHandler=new Fe({layerViewUid:this.layerViewUid,sublayerId:this.sublayerId,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:u}),this._elevationProvider=new Xe({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this._updatingHandles.add(()=>this.view.clippingArea,()=>this._clippingAreaChanged(),_),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),_),this._updatingHandles.add(()=>!this.suspended&&0!==this.elevationInfo.mode,(e,t)=>{e?this.addHandles(this.view.basemapTerrain.on("elevation-change",({extent:e})=>this._ensureElevationTask().addExtent(e)),Gt):t&&this.removeHandles(Gt)},_),this._updatingHandles.add(()=>this._usePBR,e=>this._updatePBR(e));const m=()=>{this._reloadAll(),this.clearMemCache()};this._updatingHandles.add(()=>this.rendererTextureUsage,m),this._updatingHandles.add(()=>this.contentVisible,e=>this._contentVisibleChanged(e),_),this._updatingHandles.add(()=>this.i3slayer.labelsVisible,()=>this._labelingChanged(),_),this._updatingHandles.add(()=>this.i3slayer.labelingInfo,()=>this._labelingChanged(),_),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),_),this.addHandles([g(()=>rt.I3S_TREE_SHOW_TILES,e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then(({I3STreeDebugger:t})=>{!this._treeDebugger&&rt.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else e||rt.I3S_TREE_SHOW_TILES||(this._treeDebugger=a(this._treeDebugger))},_),g(()=>rt.I3S_SHOW_MODIFICATIONS,()=>this._showModifications(),_)]),this._cacheKeySuffix=this._getCacheKeySuffix(),this._idbCache.init().catch(e=>o.getLogger(this).warn(`Failed to initialize IndexedDB cache: ${e}`));const{view:f}=this,{viewingMode:p,renderCoordsHelper:y}=f;this._planetRadiusInGlobalMode="local"===p?0:y.referenceEllipsoid.radius}destroy(){this._clearAddTasks(),this._elevationTask=a(this._elevationTask),this.i3sOverrides=a(this.i3sOverrides),this._elevationProvider&&(this._elevationProvider.notifyObjectsChanged(this.getVisibleObbs()),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._workerHandle;e&&(e.destroyContextAndSelf(this.uid),this._workerHandle=null),this._removeAllNodeDataFromStage(),this._memCache=a(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=a(this._labeler),this._treeDebugger=a(this._treeDebugger),this._controller=a(this._controller),this._highlights=a(this._highlights),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this._crossfadeHelper=a(this._crossfadeHelper),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null),this._updatingHandles=a(this._updatingHandles)}_memEstimateTextureAdded(e){const t=e.usedMemory;return this._gpuMemoryEstimate+=t,this._texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(null!=e){const t=e.usedMemory;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)}get usedMemory(){let e=null!=this._labeler?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach(t=>e+=null!=t?t.node.memory:0),this._nodeId2MetaReloading.forEach(t=>e+=null!=t?t.node.memory:0),e}get unloadedMemory(){return(null!=this._controller?this._controller.unloadedMemoryEstimate:0)+(null!=this._labeler?this._labeler.unloadedMemoryEstimate:0)}_labelingChanged(){if(!(we(this.i3slayer)&&this._supportsLabeling))return void(null!=this._labeler&&(this._labeler.destroy(),this._labeler=null));if(null!=this._labeler)return;const e=new me({view:this.view,layer:this.i3slayer,collection:this._collection,overrides:this.i3sOverrides,layerViewUid:this.uid});this._nodeId2Meta.forEach(t=>null!=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=be().then(()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()}),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=e=>o.getLogger(this).error("set-modifications-error","Error when setting modifications:",e),t=this.uid,i=this.i3slayer.spatialReference,s=i.isGeographic,r=ye(this._layerClippingArea,this._modifications,i);this._workerHandle.setModifications(t,r,s).catch(e);try{ve({context:t,modifications:r,isGeodetic:s})}catch(a){e(a)}this._controller.modificationsChanged();const n=this.hasModifications?new l:null;this._nodeId2Meta.forEach((e,t)=>{null==e?(this._nodeId2Meta.delete(t),this._controller.updateLoadStatus(t,!1)):e.node.hasModifications?(this._updateFeatureIdCounts(e,-1),this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):null!=n&&n.push(e.node)}),this.notifyChange("elevationRange"),null!=n&&this._nodeId2MetaReloading.forEach(e=>n.push(e.node)),null!=n&&n.length>0&&(this.updateNodeModificationStatus(n),n.forAll(e=>{if(2!==e.imModificationImpact){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),null!=t?(this._updateFeatureIdCounts(t,-1),this._nodeId2Meta.delete(e.index),this._nodeId2MetaReloading.set(e.index,t),this.notifyChange("elevationRange")):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(null!=this._modificationGraphics&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!rt.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={outline:{color:[255,255,255],width:1}};this._modificationGraphics=[];for(const s of this._modifications){const r=s.geometry;r.spatialReference=this.i3slayer.spatialReference;const o=new _e({...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))}_contentVisibleChanged(e){e?(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler)):(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);null!=i?.attributeInfo&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);null!=s&&(await this.i3sOverrides.applyAttributeOverrides(s.featureIds,t,i,this._controller.requiredAttributes),s.attributeInfo=t,this._controller.reschedule(()=>{this._nodeId2Meta.get(e)===s&&this._attributeValuesChanged(s)},i).catch(e=>{h(e)||o.getLogger(this).warn("Error while updating attribute values. Layer might not display correctly.",e)}))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.appliedFilters=null,null!=this._labeler&&this._labeler.setNodeMetaAttributes(e,(e,t)=>this._createAttributes(e,t)),this._updateEngineObject(e)}clearMemCache(){null!=this._memCache&&this._memCache.clear(),this._addTasks.forEach(e=>e.allowMemCache=!1)}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach(t=>null!=t&&e.push(t.node)),e}getVisibleObbs(){const e=new Array;return this._nodeId2Meta.forEach(t=>t&&e.push(this._collection.getComponentObb(t.objectHandle))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach((t,i)=>e.push(i)),this._nodeId2MetaReloading.forEach((t,i)=>e.push(i))}_preLoadBasis(){!has("disable-feature:i3s-basis")&&2&this.supportedTextureEncodings&&this.i3slayer.textureSetDefinitions?.some(e=>e.formats.some(e=>"basis"===e.format||"ktx2"===e.format))&&pt()}_getVertexBufferLayout(e,t){return ht(ut(this._getGeometryParameters({hasTexture:Vt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion})))}_getObjectIdField(){return this.i3slayer.objectIdField||se}_getGlobalIdField(){return this.i3slayer.globalIdField}_findGraphicNodeAndIndex(e){const t=et(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());for(const i of this._nodeId2Meta.values()){const e=i?.featureIds.indexOf(t);if(null!=e&&e>=0)return{node:i.node,index:e}}return null}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(null==i)return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const n of t){const e=et(o,n.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 null==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(null==i?.featureIds||t>=i.featureIds.length)return null;const s=i.objectHandle,r=Ee(t,this._collection,s,Y(24),0),o=this.view.renderSpatialReference,n=this.view.spatialReference;return B(r,o,0,r,n,0)?W(r):null}whenGraphicAttributes(e,t){return Ge(this.i3slayer,e,this._getObjectIdField(),t,()=>[...this._nodeId2Meta.values()].filter(r))}getGraphicFromIntersectorTarget(e,t){if(null==e.nodeIndex||null==e.componentIndex)return null;const i=this._nodeId2Meta.get(e.nodeIndex);if(null==i?.featureIds||e.componentIndex>=i.featureIds.length)return null;const s=this._createLayerGraphic(this._createAttributes(e.componentIndex,i));return s?t.defer?(t.defer(async()=>(s.geometry=(await import("./i3s/meshUtils.js")).createMesh({layerView:this,nodeIndex:e.nodeIndex,featureIndex:e.componentIndex}),s)),null):s:null}_getCacheKey(e){return`${this._layerUrl}/v${Mt}/${e}${this._cacheKeySuffix}`}_getCacheKeySuffix(){const e=this.view.renderSpatialReference;if(null==e)return qt;if(e===U(e))return zt;return this.i3slayer.spatialReference.equals(e)?Bt:null!=e.wkid?`@${e.wkid}`:null}_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 null!=this._memCache?this._memCache.pop(this._getMemCacheKey(e)):null}deleteCachedGPUData(e){null!=e&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(null==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,i)}loadMissingTextures(e,t,i,s){const r=e?.filter((e,i)=>{if(0===(e.usage&this.rendererTextureUsage))return!1;if(null==t)return!0;const s=De(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(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.id),t).then(s=>null==s?null:(s.globalTrafo=X(s.globalTrafo),s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e.id)),null):(0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=at.fromData(s.geometryObbData)),this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then(i=>(i&&this._idbCache.initialized&&null!=s.textureData&&(s.byteSize=Tt(s.transformedGeometry,s.textureData),s.textureData.every(At)&&this._indexedDbSizeCheck(e,s)&&this._idbCache.put(this._getCacheKey(e.id),s).catch(t=>o.getLogger(this).warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`))),c(t),s))))):Promise.resolve(null)}addNode(e,t,i){return Dt(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(null==s)return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:n,featureIds:a,anchorIds:l,anchors:d,transformedGeometry:h}=s,c=X(s.globalTrafo),u=O(Ut,r.center.x,r.center.y,r.center.z);j(u,u,c);const _=new at(u,[r.extents.x,r.extents.y,r.extents.z],S(r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w));0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=_),t.geometryData.componentOffsets=n,a&&(t.geometryData.featureIds=Array.from(a)),t.geometryData.anchorIds=l,t.geometryData.anchors=d;const g={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:h,globalTrafo:c,geometryObbData:_.data,byteSize:Tt(h,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&this._indexedDbSizeCheck(e,g)){const t=null!=g.textureData?g.textureData.map(e=>At(e)?e:null):null;this._idbCache.put(this._getCacheKey(e.id),{...g,textureData:t}).catch(t=>o.getLogger(this).warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`))}return this._addCachedNodeData(e,g,i)},i))):Promise.reject()}getElevationRange(e){const t=new ot,i=this._controller,{index:s}=i;if(!s)return t;const{rootNode:r}=s;if(!r)return t;const o=this._nodeId2Meta,n=e.radius,a=i.viewportQueries,l=this._planetRadiusInGlobalMode,{view:d}=this,{renderCoordsHelper:h}=d,c=h.referenceEllipsoid.radius,u=this._collection,_=i=>{const{childrenLoaded:s}=i;if(0===s)return!1;const r=a.getAndUpdateVisibilityObbInRenderSR(i);let d=null,_=-1;if(r){if(_=r.radius,!r.intersectSphereWithMBS(e,_))return!1}else d=a.getServiceMbsInRenderSR(i),d&&(_=d.radius);if(_>=0&&n>=1*_)return null!=r?Kt(t,r,l):null!=d&&d.radius>=0&&Qt(t,d,l),!1;const g=$t;if(g.elevationRangeMin=1/0,g.elevationRangeMax=-1/0,(null!=r||null!=d)&&(null!=r?Kt(g,r,l):null!=d&&Qt(g,d,l),g.elevationRangeMin>=t.elevationRangeMin&&g.elevationRangeMax<=t.elevationRangeMax))return!1;const m=o.get(i.index);if(m){const{geometryObbInRenderSR:s}=i;if(!s||s.intersectSphereWithMBS(e)){if(s){if(n>0*s.radius)return Kt(t,s,l),!1}const{objectHandle:e}=m,i=u.getObjectTransform(e),r=h.getAltitude(i.position);u.expandRangeWithComponentObjectElevationRange(e,r,c,t)}}return s-(m?1:0)>0};return s.traverse(r,_),t}computeVisibilityObb(e){return Be(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications,this.view.renderCoordsHelper.sphericalPCPF)}_transformNode(e,t,i){const s=t.geometryData.geometries??[],r=new Array(s.length);for(let f=0;f<s.length;++f)r[f]=this._getVertexBufferLayout(s[f],t.geometryDescriptor);const o=this.i3slayer.normalReferenceFrame,n=t.normalReferenceFrame??o??"none",a=e.serviceMbsInIndexSR,l=this.elevationOffset,d=this._controller.crsIndex,h=this._controller.crsVertex,c=this.view.renderSpatialReference,u=Pe(a,l,n,d,c),_=q(d,h),g=q(h,c);if(null==_||null==g)return Promise.resolve(null);const m={context:this.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,globalTrafo:u,mbs:a.toJSON(),obbData:e.serviceObbInIndexSR?.data,elevationOffset:l,needNormals:this._controller.isMeshPyramid,normalReferenceFrame:n,indexToVertexProjector:_,vertexToRenderProjector:g};return this._workerHandle.invoke(m,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(0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=this._collection.getComponentObb(t.objectHandle).clone()),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);null!=this._labeler&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,!0),this._updateMaterial(t),this._setNewNodeOpacity(t),0!==this.elevationInfo.mode&&this._ensureElevationTask().schedule(s),this._updateEngineObject(t),this._highlights?.objectCreated(t),null!=this._treeDebugger&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,()=>this._addCachedNodeData(e,t,s))}async deleteCachedNodeData(e){if(this._idbCacheEnabled)return this._idbCache.remove(this._getCacheKey(e))}async _addCachedNodeData(e,t,i){if(!this.contentVisible||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(null==t)return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:n}=t;await this.i3sOverrides.applyAttributeOverrides(r.featureIds,s.attributeInfo,i,this._controller.requiredAttributes);const a=null!=t.textureData?t.textureData.filter(e=>null!=e&&0!==(e.usage&this.rendererTextureUsage)):[];!has("disable-feature:i3s-basis")&&a.some(e=>null!=e&&(2===e.encoding||1===e.encoding))&&await pt(),e.memory=0;const{componentOffsets:l,geometries:d,featureIds:h,anchorIds:c,anchors:u}=r,_=this._collection,g=d[0],{layout:m,indices:f,interleavedVertexData:p,positionData:y,hasColors:b}=n,{material:S,geometryParameters:O}=this._materialParameters(g,m),j=l||new Uint32Array([0,f?f.length:p.byteLength/m[0].stride]),V=new _t({data:p,count:p.byteLength/m[0].stride,layoutParameters:O},{positions:Z(y.data),indices:ee(y.indices)},f,j),D=g.transformation?x(g.transformation):R(),A=X(t.globalTrafo);M(D,A,D);const T=w(H(),D),N=v(C(),D),k=this.view.renderSpatialReference,U=this.view.basemapTerrain.spatialReference,G=at.fromData(lt(t.geometryObbData)).center,B=[1,1,1];L(G,k,B,U)||o.getLogger(this).errorOnce("Unsupported coordinate system for IM overlay");const q=H();z(G,k,q,U);const W=C();I(W,N);const $=H();E($,F($,G,T),W);const K=q[0]-$[0]*B[0],Q=q[1]-$[1]*B[1],J=_.createObject(new ct(P(K,Q,B[0],B[1]),new mt(T,N),at.fromData(lt(t.geometryObbData)),V,!this._isIntegratedMesh)),Y=2===O.textureCoordinateType,{textures:te,texturePromise:ie}=this._initMaterialAndTextures(J,S,a,Y,e);e.memory+=this._memEstimateGeometryAdded(J),e.memory+=te.reduce((e,t)=>e+(null!=t?this._memEstimateTextureAdded(t):0),0);const se=!!S.hasParametersFromSource,re="blend"!==S.alphaMode&&S.metallicRoughness.baseColorFactor[3]>=1,oe=new Ct(e,h,J,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:se,isOpaque:re},te,c,u);s.meta=oe,this._hasTextures||=t.requiredTextures?.some(({usage:e})=>!!(19&e))||!!e.resources.texture,this._hasData=!0,this._hasColors||=b,this.notifyChange("hasTexturesOrVertexColors");const ne=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(oe),ie]).then(([t,s])=>(this._addTasks.has(e.index)&&t?.updateObjectVisibility(oe.objectHandle,!1).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),this._safeReschedule(()=>{const i=this._addTasks.get(e.index);if(!i)return;if(this._addNodeMeta(e.index,oe),i.meta=null,!this.contentVisible)return void this._removeNodeStageData(e.index,this.elevationOffset);_.setObjectVisibility(J,!0),t?.updateObjectVisibility(oe.objectHandle,!0).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),oe.attributeInfo=i.attributeInfo;const s=oe.cachedRendererVersion!==this._rendererVersion,r=ne!==this.slicePlaneEnabled;this._updateElevationOffsets(oe);const o=oe.elevationOffsets;this._updateComponentData(oe);const n=this._applyFiltersToNode(oe);(s||null!=t&&(r||n||o))&&this._addOrUpdateEdgeRendering(oe),null!=this._labeler&&this._addMetaToLabeler(this._labeler,oe),this._visibleGeometryChanged(oe,0),this._highlights?.objectCreated(oe),this._updateMaterial(oe),this._setNewNodeOpacity(oe),null!=this._treeDebugger&&this._treeDebugger.update()},i))).catch(e=>{const{meta:t,allowMemCache:i}=s;throw s.meta=null,t&&i?this._cacheGPUData(t):t&&this._deleteComponentObject(t),e})}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){o.getLogger(this).error("Removing duplicated node");const t=this._nodeId2Meta.get(e);t&&(this._deleteComponentObject(t),this._updateFeatureIdCounts(t,-1))}else this._controller.updateLoadStatus(e,!0);t&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Pt(t.cachedEdgeMaterials,0),this._updateFeatureIdCounts(t,1)),this._nodeId2Meta.set(e,t),this.notifyChange("elevationRange")}_updateElevationOffsets(e){if(!e.node.serviceMbsInIndexSR)return;const{view:t,elevationInfo:i}=this,s=this._controller.crsIndex,{groundView:r,groundSpatialReference:o,renderSpatialReference:n}=t,a=i.mode;if(null==n||null==o||0===a)return void(e.elevationOffsets=null);const l=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const d=Ut,h=Lt,c=2===a,u=this.view.renderCoordsHelper,_=e.featureIds.length,g=(()=>{if(e.cachedElevationAnchors)return e.cachedElevationAnchors;const t=Y(3*_);e.cachedElevationAnchors=t;const{center:i}=e.node.serviceMbsInIndexSR;for(let r=0;r<_;r++){const a=3*r,c=e.anchorIds?.indexOf(r)??-1;e.anchors&&c>=0?(O(d,e.anchors[3*c],e.anchors[3*c+1],e.anchors[3*c+2]),V(d,d,i),z(d,s,d,o),t[a]=d[0],t[a+1]=d[1],t[a+2]=u.getAltitude(d)):(this._collection.getComponentAabb(e.objectHandle,r,h,!0),O(d,(h[0]+h[3])/2,(h[1]+h[4])/2,h[2]),E(d,d,l.rotationScale),V(d,d,l.position),t[a+2]=u.getAltitude(d),z(d,n,d,o),t[a]=d[0],t[a+1]=d[1])}return t})(),m=i.offset,f=e.elevationOffsets,p=(e,t)=>{const i=c?g[3*e+2]:0;f[e]=m+(t??0)-i};r.getElevations(g,_,p)}_ensureElevationTask(){return null!=this._elevationTask||(this._elevationTask=new Re(this.view.resourceController.scheduler,e=>this._controller.updateElevationChanged(e,this.view.basemapTerrain.spatialReference)?.filterInPlace(e=>null!=this._nodeId2Meta.get(e)),e=>this._nodeElevationAlignmentChanged(this._nodeId2Meta.get(e)),()=>this.elevationInfo?.mode)),this._elevationTask}_elevationInfoChanged(e,t){const i=0!==e.mode,s=!!t&&t!==e&&0!==t.mode;this._intersectionHandler.updateElevationAlignState(i,this.view.state.viewingMode),i&&!s&&this._controller.removeAllGeometryObbs(),this._nodeId2Meta.forEach(e=>this._nodeElevationAlignmentChanged(e))}_nodeElevationAlignmentChanged(e){null!=e&&(this._updateElevationOffsets(e),this._updateComponentData(e),this._updateEdgeRendering(e),null!=this._labeler&&this._labeler.updateLabelPositions(e),this._updateSnappingSources(e,2),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e.objectHandle)))}_safeReschedule(e,t){return c(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=null!=e.params.material?e.params.material:Ae(),s=t.some(e=>"uvRegion"===e.name),r=t.some(e=>"normalCompressed"===e.name),o=Vt(i);return{geometryParameters:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s,r){const o=this._stage.renderView,n=e=>{this._gpuMemoryEstimate-=e,this._texMemoryEstimate-=e,r.memory-=e},a=i.map(e=>Te(e,t,s,o,this._compressionTracker,n));this._stage.addTextures(a);let l=null;return this._collection.updateMaterial(e,e=>{l=He(e,t,a,i,this.view.stage.renderView.textures,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)}),{textures:a,texturePromise:l}}_getGeometryParameters(e){return new gt(this._hasVertexColors,e.hasTexture?e.hasRegions?2:1:0,e.hasNormals,this._shadeNormals,this._applySSAO)}_addData(e,t,i){let s=this._addTasks.get(e.index);if(s)s.attributeInfo=t;else{const r=u();s=new Nt(t,null,r.promise),this._addTasks.set(e.index,s),i().then(r.resolve,r.reject).then(()=>this._addTasks.delete(e.index)).catch(t=>{throw this._addTasks.delete(e.index),t})}return s.promise}_clearAddTasks(){this._addTasks.forEach(e=>{null!=e.meta&&(this._cacheGPUData(e.meta),e.meta=null)}),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=Q();this._renderClippingArea=nt(this.view.clippingArea,i,e)?i:null;const s=Q();this._layerClippingArea=nt(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),this._assertFeatureIdNodeCounts(e)}_assertFeatureIdNodeCounts(e){e&&!this._featureIdCounts?(this._featureIdCounts=Zt(this._nodeId2Meta.values()),this._filteredIdCounts=Zt(this._nodeId2Meta.values(),1),this._weaklyRemovedIdCounts=Zt(this._nodeId2Meta.values(),2),this.addHandles(g(()=>this._controller.updating,e=>{!e&&this._needFilterResolve&&(this.multiGeometryFilterResolve(),this._needFilterResolve=!1,this.notifyUpdate())},{sync:!0}),"updateFinished")):!e&&this._featureIdCounts&&(this._featureIdCounts=null,this._filteredIdCounts=null,this._weaklyRemovedIdCounts=null,this._mismatchShow=null,this._mismatchHide=null,this.removeHandles("updateFinished"),this._needFilterResolve=!1,this.notifyUpdate())}_updateFeatureIdCounts(e,t){this._featureIdCounts&&(this._needFilterResolve=!0,Xt(this._featureIdCounts,e.featureIds,t),Xt(this._filteredIdCounts,e.filteredIds,t),Xt(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,t))}_updateFilteredIdCounts(e,t,i){this._filteredIdCounts&&(this._needFilterResolve=!0,Xt(this._filteredIdCounts,t,-1),Xt(this._filteredIdCounts,e.filteredIds,1),Xt(this._weaklyRemovedIdCounts,i,-1),Xt(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,1))}_checkFeatureIdNodeCountInvariant(){const e=null!=this._featureIdCounts;if(this.hasGeometryFilter!==e&&o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","LayerView should have feature id node counts if and only if it has a geometry filter",{layerView:this,hasNodeCounts:e}),!this._featureIdCounts||!this._filteredIdCounts)return;const t=Zt(this._nodeId2Meta.values());n(this._featureIdCounts,t)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _featureIdCounts",{layerView:this,counts:this._featureIdCounts,expected:t});const i=Zt(this._nodeId2Meta.values(),1);n(this._filteredIdCounts,i)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _filteredIdCounts",{layerView:this,counts:this._filteredIdCounts,expected:i});const s=Zt(this._nodeId2Meta.values(),2);n(this._weaklyRemovedIdCounts,s)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _weaklyRemovedIdCounts",{layerView:this,counts:this._weaklyRemovedIdCounts,expected:i})}multiGeometryFilterResolve(){if(!this._featureIdCounts||!this._filteredIdCounts)return;let e=null,t=null;for(const[i,s]of this._filteredIdCounts){const r=this._featureIdCounts.get(i);if(r!==s){s+(this._weaklyRemovedIdCounts?.get(i)??0)===r?(e??=new Set,e.add(i)):(t??=new Set,t.add(i))}}f(e,this._mismatchShow)&&f(t,this._mismatchHide)||(this._mismatchShow=e,this._mismatchHide=t,this._nodeId2Meta.forEach(e=>{if(!e?.filteredIds)return;const t=Yt(e,this._mismatchShow,this._mismatchHide);this._collection.setAllComponentVisibilities(e.objectHandle,t),this._visibleGeometryChanged(e,2)}))}_filterChange(){this._applyFilters(this.hasGeometryFilter)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach(e=>{e&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,2))})}getFilters(){const e=[],t=this._renderClippingArea;return null!=t&&e.push((e,i)=>this._boundingRectFilter(e,i,t)),e}addSqlFilter(e,t,i){if(null!=t){const s=t.fieldNames;e.push((e,r)=>this._sqlFilter(e,r,t,s,i))}}_sqlFilter(e,t,i,s,r){const o={},n=this._createLayerGraphic(o);if(!n)return;const a=this.i3slayer.objectIdField,l=t.featureIds,d=t.attributeInfo?.attributeData;s.every(e=>e===a||null!=d?.[e])&&qe(e,l,e=>{o[a]=l[e];for(const i of s)i!==a&&(o[i]=d?Se(d[i],e):null);try{return i.testFeature(n)}catch(t){return r(t),!1}})}_boundingRectNodeTest(e,t){return G(e.node.serviceMbsInIndexSR,this._controller.crsIndex,Ft,this.view.renderSpatialReference),ze(t,Ft)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,Rt),K(Rt,St),J(i,St)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(3===r)return;if(0===r)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const n=this._transformClippingArea(Ot,i,t.objectHandle);qe(e,t.featureIds,e=>this._boundingRectFeatureTest(t,e,n))}_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}async _addOrUpdateEdgeRendering(e,t=!0){const i=e.objectHandle,{hasEdges:s,perFeatureEdgeMaterials:r}=this._getFilteredEdgeMaterials(e);s&&!this._edgeView&&(this._edgeView=await this._stage.renderer.loadEdgeView());const o=this._edgeView;if(!o)return null;const n=o.hasObject(i);if(s){if(n){if(this.nodeCrossfadingEnabled){Pt(r,this.getNodeOpacity(e))}return o.updateAllComponentMaterials(i,r,this.slicePlaneEnabled,t).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),o.updateObjectVisibility(i,!0).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),o.updateAllVerticalOffsets(i,e.elevationOffsets).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),o}const s=await this._collection.addEdges(i,o,r,this.slicePlaneEnabled,e.elevationOffsets);return e.edgeMemoryUsage=s,e.node.memory+=s,o}return n&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,o.removeObject(i)),null}_applyFiltersToNode(e){const{filteredIds:t,weaklyRemovedIds:i}=e,s=this._applyFiltersToNodeComponents(e);return this._updateFilteredIdCounts(e,t,i),s&&this._labeler?.applyFilterChange(e),s}_applyFiltersToNodeComponents(e){const t=this._collection,i=t.getComponentCount(e.objectHandle),s=null!=e.filteredIds,r=0===i.invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!r;if(null!=e.filteredIds&&e.appliedFilters===this._filters||(e.weaklyRemovedIds=null,e.filteredIds=Jt(e,this._filters),e.appliedFilters=this._filters),s&&e.filteredIds===e.featureIds&&(!this._mismatchHide||e.filteredIds.every(e=>!this._mismatchHide?.has(e))))return!r;const o=Yt(e,this._mismatchShow,this._mismatchHide);return t.setAllComponentVisibilities(e.objectHandle,o),!0}_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=a(this._elevationTask)}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading),null!=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);null!=s?(this._collection.setObjectVisibility(s.objectHandle,!1),null!=this._edgeView&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),this._visibleGeometryChanged(s,1),null!=this._labeler&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights?.objectDeleted(s),i===this._nodeId2Meta?(this._updateFeatureIdCounts(s,-1),this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),null!=this._treeDebugger&&this._treeDebugger.update()):i.delete(e)}_deleteComponentObject(e){if(null!=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.removeTexture(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._collection.updateMaterial(i.objectHandle,e=>e.polygonOffsetEnabled=0===t)}updateNodeIndex(e,t){if(this._nodeId2Meta.has(e)){const i=this._nodeId2Meta.get(e);this._nodeId2Meta.delete(e),this._nodeId2Meta.set(t,i),this.notifyChange("elevationRange")}const i=this._nodeId2MetaReloading.get(e);i&&(this._nodeId2MetaReloading.delete(e),this._nodeId2MetaReloading.set(t,i))}_invalidateAllSymbols(){this._rendererVersion=We(this._rendererVersion,1),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 ce()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:o.getLogger(this).warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.symbols)"mesh-3d"!==t.type&&o.getLogger(this).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=i*e.cachedSymbologyStride;N(s.externalColor,t[r]/255,t[r+1]/255,t[r+2]/255,t[r+3]/255);const o=this._stage.renderView.olidRenderHelper;if(o){const t=e.featureIds[i],r=this.sublayerId?`${this.layerViewUid}_${this.sublayerId}`:this.layerViewUid,n=de(this.view,this.uid);o.setUidToObjectAndLayerId(t,t,this.layerId,r,this.layerPopupEnabledAndHasTemplate&&!n,e.node.resources.attributes,i,this.sublayerId),s.olidColor=o.getObjectAndLayerIdColor({graphicUid:t,layerViewUid:r})}s.externalColorMixMode=15&t[r+4],s.castShadows=!!(16&t[r+4]),s.pickable=!!(32&t[r+4]),s.elevationOffset=e.elevationOffsets?.[i]??0,s.emissiveStrength=e.emissiveStrengths?.[i]??1,s.emissiveSource=e.emissiveSources?.[i]??0}}_getSymbolInfo(e,t){const i=e?.getSymbol(t,{arcade:this._arcade});if(!(i instanceof ue))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=null!=this._symbologyOverrideFields&&this._symbologyOverrideFields.length>0?null!=this._rendererFields&&this._rendererFields.length>0?oe(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=e.attributeInfo?.attributeData,o=e.featureIds?this.i3slayer.objectIdField:null,n=null!=r&&null!=this._symbologyFields&&this._symbologyFields.length>0;let a=null,l=null;if(n&&null!=this._symbologyFields){a=[],l=[];for(const e of this._symbologyFields){const t=r[e];t&&(a.push(e),l.push(t))}}e.cachedSymbology||(e.cachedSymbology=ie(e.featureIds.length*e.cachedSymbologyStride));const d=new Ze,h=this.fullOpacity,c=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let u=null,_=1,g=Ke,m=0;for(let f=0;f<e.featureIds.length;f++){if(null!=o&&(i[o]=e.featureIds[f]),n&&a)for(let e=0;e<a.length;e++)i[a[e]]=Se(l[e],f);const r=s?this._getSymbolInfo(s,t):null;let h,p;if(d.pickable=!0,s&&"visualVariables"in s){if(this._colorVariable){const e=ae(this._colorVariable,t,{color:Et,arcade:this._arcade});e&&(h=d.color,h[0]=e.r/255,h[1]=e.g/255,h[2]=e.b/255,h[3]=e.a??1,this._opacityVariable||null===e.a||(p=e.a))}this._opacityVariable&&(p=le(this._opacityVariable,t,{arcade:this._arcade}))}if(r?.material){const e=r.material;h=null==h||null==p?Me(h,p,e.color,e.alpha,It,d.color):Me(h,p,null,null,It,d.color)}h??=N(d.color,1,1,1,1);const y=r?.material;if(d.colorMixMode=y?.colorMixMode??1,d.edgeMaterial=r?.edgeMaterial,this._symbologyOverride?.(t,d),null!=this._nodeColorOverride&&(this._nodeColorOverride(e.node,h),d.colorMixMode=3),d.pickable&&=h[3]>=vt,d.castShadows=r?r.castShadows:d.pickable,null!=d.edgeMaterial){const t=h[3]>=1&&(e.material.isOpaque||3===d.colorMixMode)?1:0;d.edgeMaterial===u&&t===_||(g={...d.edgeMaterial,opacity:c,objectTransparency:t},u=d.edgeMaterial,_=t),e.cachedEdgeMaterials[f]=g}else e.cachedEdgeMaterials[f]=Ke;e.cachedSymbology[m++]=Math.round(255*h[0]),e.cachedSymbology[m++]=Math.round(255*h[1]),e.cachedSymbology[m++]=Math.round(255*h[2]),e.cachedSymbology[m++]=Math.round(255*h[3]),e.cachedSymbology[m++]=d.colorMixMode|+d.castShadows<<4|+d.pickable<<5;const b=y?.emissive?.strength??ft;b===ft||e.emissiveStrengths||(e.emissiveStrengths=new Array(e.featureIds.length).fill(ft)),e.emissiveStrengths&&(e.emissiveStrengths[f]=b);const v=y?.emissive?.source||0;0===v||e.emissiveSources||(e.emissiveSources=new Array(e.featureIds.length).fill(0)),e.emissiveSources&&(e.emissiveSources[f]=v)}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);this.nodeCrossfadingEnabled||Pt(t,this.fullOpacity);const i=e.filteredIds;if(null==i){return{hasEdges:t.some(e=>e!==Ke),perFeatureEdgeMaterials:t}}let s=0,r=!1;const o=t.map((t,o)=>e.featureIds[o]!==i[s]?Ke:(r=r||t!==Ke,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=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,t=>t.objectOpacity=e),Pt(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,2)}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),null!=this._labeler&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach(t=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,t=>t.commonMaterialParameters.hasSlicePlane=e),this._updateEdgeRendering(t,!1))})}_updatePBR(e){this._nodeId2Meta.forEach(t=>{null!=t&&this._collection.updateMaterial(t.objectHandle,t=>t.usePBR=e)}),this._hasLoadedPBRTextures=!0}get _usePBR(){return this._shadeNormals&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){null!=this._edgeView&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_ignoreClientNodeOverriddenFeatures(e){return this.i3sOverrides.hasGeometryChanges?(t,i,s)=>s.node.index>=0&&this.i3sOverrides.featureHasGeometryChanges(t)?0:e(t,i,s):e}_forAllFeatures(e,t,i){for(const s of this._nodeId2Meta.values())if(!(null==s||t&&s.node.serviceMbsInIndexSR&&1===t(s.node.serviceMbsInIndexSR)))switch(i){case 1:this._forAllFeaturesOfNode(s,e);break;case 0:this._forAllVisibleFeaturesOfNode(s,e);break;case 2:this._forAllQueryableFeaturesOfNode(s,e)}}_forAllFeaturesOfNode(e,t){e.featureIds.forEach((i,s)=>t(i,s,e))}_forAllVisibleFeaturesOfNode(e,t){const i=e.featureIds;this._collection.forEachVisibleComponent(e.objectHandle,s=>0===t(i[s],s,e))}_forAllQueryableFeaturesOfNode(e,t){const i=this._ignoreClientNodeOverriddenFeatures(t);if(null==this._renderClippingArea)return this._forAllFeaturesOfNode(e,i);const s=this._boundingRectNodeTest(e,this._renderClippingArea);if(0===s)return;if(3===s)return this._forAllFeaturesOfNode(e,i);const r=e.featureIds,o=e.objectHandle,n=Qe(this._renderClippingArea,this._collection.getObjectTransform(o));for(let a=0;a<r.length;a++)this._boundingRectFeatureTest(e,a,n)&&i(r[a],a,e)}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=t.attributeInfo?.attributeData;if(null!=s)for(const r of Object.keys(s))i[r]=Se(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e,t){const s=tt(e);if(0===s.length)return it;const r=yt(t),o=s[0]instanceof i?this._featureIdsFromGraphics(s):"number"==typeof s[0]?s:null;if(!o)return it;const n=this._ensureHighlights(),{set:a,handle:l}=n.acquireSet(r);return n.setFeatureIds(a,o),l}_featureIdsFromGraphics(e){const t=this.i3slayer.fieldsIndex,i=this._getObjectIdField();return e.map(e=>et(t,e.attributes,i))}_ensureHighlights(){return this._highlights??=new xe({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,1),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._highlights}resetHighlights(){this._highlights=a(this._highlights)}_visibleGeometryChanged(e,t){this._elevationProvider&&(null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=m(()=>{const{node:t}=e,i=t.visibilityObbInRenderSR??t.geometryObbInRenderSR??t.serviceObbInRenderSR;if(null!=i){const e=$();i.toAaBoundingBox(e),this.emit("visible-geometry-changed",new ge(e))}else this.emit("visible-geometry-changed");this._visibleGeometryChangedSchedulerHandle=null})),this._updateSnappingSources(e,t),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e.objectHandle)))}get performanceInfo(){return new fe(this.usedMemory,this._nodeId2Meta.size,Math.round(this._gpuMemoryEstimate/1048576),Math.round(this._geoMemoryEstimate/1048576),Math.round(this._texMemoryEstimate/1048576),Math.round(this.unloadedMemory/1048576),this._idbCacheEnabled?Math.round(100*this._idbCache.getHitRate()):0)}checkInvariants(){}get test(){}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return null!=e?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}getNodeComponentHandle(e){return this._nodeId2Meta.get(e)?.objectHandle}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(e)}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);null!=s&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);null!=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(null==this._edgeView||!e.cachedEdgeMaterials)return;Pt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t).catch(e=>this._logEdgeViewError(e,this.i3slayer.title))}get hasModifications(){return this._isIntegratedMesh&&null!=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=Ht(e);if(s){const t={context:i,buffer:s.buffer};Ie(t);const r=new Float64Array(s.buffer);e.forAll((e,t)=>{const i=r[t],s=Ce(i);e.imModificationImpact=s,0!==s&&this._controller.invalidateGeometryVisibility(e.index)})}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||null!=this._labeler&&this._labeler.updating||this._crossfadeHelper?.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0||null!=this._elevationTask&&this._elevationTask.readyToRun||this._needFilterResolve||this._compressionTracker.compressing}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(null==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(null==t)return;const s=this._controller.getRenderMbs(t.node);s&&e.add(i,s)}),t}_snappingLocationsApplyElevation(e,t,i){if(!e.elevationOffsets||0===this.elevationInfo.mode)return;const s=t.position0,r=t.position1,o=t.componentIndex,n=H(),a=H(),l=(e,t)=>{V(e,e,i),this.view.renderCoordsHelper.worldUpAtPosition(e,a),V(e,e,D(a,a,t)),A(e,e,i)};for(let d=0;d<s.count;d++){const t=e.elevationOffsets[o.get(d)];s.getVec(d,n),l(n,t),s.setVec(d,n),r.getVec(d,n),l(n,t),r.setVec(d,n)}}_updateSnappingSources(e,t){const{index:i}=e.node,s=this._controller.getRenderMbs(e.node);if(null!=s)for(const r of this._snappingSourcesTrackers)1!==t&&2!==t||r.events.remove(i),0!==t&&2!==t||r.events.add(i,s)}_logEdgeViewError(e,t){h(e)||o.getLogger(this).warn("Error while processing edges. Edges on this layer might not display correctly",t,e)}_indexedDbSizeCheck(e,t){return t.byteSize>wt?(o.getLogger(this).warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}get elevationProvider(){return this._elevationProvider}};return e([y()],T.prototype,"_hasLoadedPBRTextures",void 0),e([y()],T.prototype,"_asyncModuleLoading",void 0),e([y()],T.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([y()],T.prototype,"view",void 0),e([y()],T.prototype,"i3slayer",void 0),e([y()],T.prototype,"_controller",void 0),e([y()],T.prototype,"_labeler",void 0),e([y()],T.prototype,"updating",void 0),e([y()],T.prototype,"suspended",void 0),e([y()],T.prototype,"contentVisible",null),e([y({readOnly:!0})],T.prototype,"legendEnabled",null),e([y(dt)],T.prototype,"updatingProgress",void 0),e([y()],T.prototype,"updatingProgressValue",null),e([y()],T.prototype,"hasTexturesOrVertexColors",null),e([y()],T.prototype,"rendererTextureUsage",null),e([y()],T.prototype,"elevationOffset",null),e([y()],T.prototype,"elevationInfo",null),e([y({type:Boolean})],T.prototype,"slicePlaneEnabled",void 0),e([y()],T.prototype,"supportedTextureEncodings",null),e([y({type:[ne]})],T.prototype,"_modifications",void 0),e([y({readOnly:!0})],T.prototype,"clientGeometry",null),e([y()],T.prototype,"elevationRange",null),e([y()],T.prototype,"fullExtent",null),e([y()],T.prototype,"_elevationTask",void 0),e([y({readOnly:!0})],T.prototype,"_usePBR",null),T=e([b("esri.views.3d.layers.I3SMeshView3D")],T),T},Rt=$(),St=Q(),Ot=Q(),jt=new at,Et=new t([0,0,0,0]),Ft=new te(0,0,0,0);function Vt(e){if(null==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 Dt(e){return"geometryData"in e}function At(e){return null!=e&&p(e.data)}function Tt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(null!=t)for(const s of t)null!=s&&p(s.data)&&(i+=s.data.byteLength);return i}function Ht(e){if(0===e.length)return;const t=10*e.length,i=new Float64Array(t);let s=0;return e.forAll(e=>{let t=e.serviceObbInIndexSR;null==t&&(t=jt,e.serviceMbsInIndexSR?(t.center=e.serviceMbsInIndexSR.center,t.halfSize=[e.serviceMbsInIndexSR.radius,e.serviceMbsInIndexSR.radius,e.serviceMbsInIndexSR.radius]):t.invalidate());const r=t.data;i[s++]=r[0],i[s++]=r[1],i[s++]=r[2],i[s++]=r[3],i[s++]=r[4],i[s++]=r[5],i[s++]=r[6],i[s++]=r[7],i[s++]=r[8],i[s++]=r[9]}),i}class Nt{constructor(e,t,i){this.attributeInfo=e,this.meta=t,this.promise=i,this.allowMemCache=!0}}function Pt(e,t){e.forEach(e=>e.opacity=t)}class kt{constructor(e,t){this.mode=e,this.offset=t}}const Ut=H(),Lt=$(),Gt="elevation-change",Bt="",qt="@null",zt="@ECEF",Wt=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],$t=new ot;function Kt(e,t,i){let s=e.elevationRangeMin,r=e.elevationRangeMax;const o=i;if(o>0){t.getCorners(Wt);for(const e of Wt){const t=T(e)-o;s=Math.min(s,t),r=Math.max(r,t)}}else{t.getCorners(Wt);for(const e of Wt){const t=e[2];s=Math.min(s,t),r=Math.max(r,t)}}e.expandElevationRangeValues(s,r)}function Qt(e,t,i){const{center:s,radius:r}=t,o=i>0?T(s)-i:s[2];e.expandElevationRangeValues(o-r,o+r)}function Jt(e,t){const i=e.featureIds.slice();for(const s of t)if(s(i,e),0===i.length)break;return i.length===e.featureIds.length?e.featureIds:i}function Yt(e,t,i){const s=new Array,r=e.filteredIds;if(null==r||t?.size||i?.size){if(null!=r){let o=0;e.featureIds.forEach((e,n)=>{if(r[o]===e)++o;else if(!t?.has(e))return;i?.has(e)||s.push(n)})}}else e.featureIds.forEach((e,t)=>{r[s.length]===e&&s.push(t)});return s}function Xt(e,t,i){if(e&&t)for(const s of t){const t=(e.get(s)??0)+i;t>0?e.set(s,t):e.delete(s)}}function Zt(e,t=0){const i=new Map;for(const s of e){Xt(i,0===t?s?.featureIds:1===t?s?.filteredIds:s?.weaklyRemovedIds,1)}return i}export{xt 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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{destroyHandle as t}from"../../../core/handleUtils.js";import{watch as i,syncAndInitial as r,initial as s}from"../../../core/reactiveUtils.js";import{property as h,subclass as a}from"../../../core/accessorSupport/decorators.js";import l from"./DynamicLayerView3D.js";import n from"./ImagerySubView3D.js";import{ImageHighlightHelper3D as o}from"./support/ImageHighlightHelper3D.js";import p from"../support/flow/FlowSubViewExtent3D.js";import d
|
|
5
|
+
import{__decorate as e}from"tslib";import{destroyHandle as t}from"../../../core/handleUtils.js";import{watch as i,syncAndInitial as r,initial as s}from"../../../core/reactiveUtils.js";import{property as h,subclass as a}from"../../../core/accessorSupport/decorators.js";import l from"./DynamicLayerView3D.js";import n from"./ImagerySubView3D.js";import{ImageHighlightHelper3D as o}from"./support/ImageHighlightHelper3D.js";import p from"../support/flow/FlowSubViewExtent3D.js";import{ImageryLayerViewMixin as d}from"../../layers/ImageryLayerViewMixin.js";let g=class extends(d(l)){constructor(){super(...arguments),this.type="imagery-3d"}get highlightOptions(){return null}get pixelData(){return null}initialize(){const e=()=>this._updatingHandles.addPromise(this.refreshDebounced());this._updatingHandles.add(()=>this.layer?.exportImageServiceParameters?.version,e),this._updatingHandles.add(()=>this.layer?.renderer,e),this._updatingHandles.add(()=>this.timeExtent,e),this._highlightHelper=new o({view:this.view,layer:this.layer,updatingHandles:this._updatingHandles}),this.addHandles([t(this._highlightHelper),i(()=>this.suspended,e=>this._highlightHelper.suspended=e,r)])}_initSubView(){this.addHandles([i(()=>this.layer.renderer,e=>this._recreateSubView(e),s)])}_recreateSubView(e){const t="flow"===e?.type,i="flow"===this.subView?.type,r=this.subView;r&&t===i||(this.subView=t?new p({layerView:this}):new n({layerView:this}),r?.destroy())}getFetchOptions(){return{timeExtent:this.timeExtent}}highlight(e,t){return this._highlightHelper.highlight(e,t)}isUpdating(){return super.isUpdating()||this._highlightHelper.updating}};e([h()],g.prototype,"highlightOptions",null),e([h()],g.prototype,"pixelData",null),g=e([a("esri.views.3d.layers.ImageryLayerView3D")],g);const u=g;export{u 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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as s}from"tslib";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerView3D as a}from"./LayerView3D.js";import{LayerViewAnalysisViewManager as r}from"./support/LayerViewAnalysisViewManager.js";import t from"../../layers/LayerView.js";import n
|
|
5
|
+
import{__decorate as s}from"tslib";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerView3D as a}from"./LayerView3D.js";import{LayerViewAnalysisViewManager as r}from"./support/LayerViewAnalysisViewManager.js";import t from"../../layers/LayerView.js";import{LineOfSightLayerViewMixin as n}from"../../layers/LineOfSightLayerViewMixin.js";var o;let l=class extends(a(n(t))){static{o=this}constructor(s){super(s),this.type="line-of-sight-3d",this._analysisViewManager=null}initialize(){this._analysisViewManager=new r({getAnalysis:()=>this.layer.analysis,loadAnalysisViewModule:o.loadAnalysisViewModule,parent:this}),this.addResolvingPromise(this._analysisViewManager.whenAnalysisView())}destroy(){this._analysisViewManager.destroy()}get analysisView(){return this._analysisViewManager.analysisView}whenAnalysisView(){return this._analysisViewManager.whenAnalysisView()}isUpdating(){return this._analysisViewManager.updating}static{this.loadAnalysisViewModule=()=>import("../analysis/LineOfSightAnalysisView3D.js")}};s([i()],l.prototype,"type",void 0),s([i()],l.prototype,"_analysisViewManager",void 0),s([i({readOnly:!0})],l.prototype,"analysisView",null),l=o=s([e("esri.views.3d.layers.LineOfSightLayerView3D")],l);const y=l;export{y as default};
|