UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 9.47 kB
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Logger.js";import{isNone as i,isSome as s,destroyMaybe as o}from"../../../core/maybe.js";import{initial as l}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{WhereClause as u}from"../../../core/sql/WhereClause.js";import d from"../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as h}from"../../../layers/support/floorFilterUtils.js";import p from"../../../rest/support/Query.js";import{sceneLayerEditingEnabled as c}from"../../../support/featureFlags.js";import{I3SMeshView3D as y}from"./I3SMeshView3D.js";import{ForAllFeaturesVisibilityMode as g}from"./II3SMeshView3D.js";import{LayerView3D as f}from"./LayerView3D.js";import{createInteractiveEditSession as m,processGeometryEdits as _,processAttributeEdits as F}from"./i3s/attributeEditing.js";import{createGetFeatureExtent as v}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as j}from"./i3s/I3SMeshViewFilter.js";import{NodeFilterImpact as w}from"./i3s/I3SNode.js";import{I3SOverrides as I}from"./i3s/I3SOverrides.js";import{I3SQueryEngine as S}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as b}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as E}from"./i3s/I3SQueryFeatureStore.js";import{checkRecyclable as C,getIndexCrs as x,objectIdFilter as Q}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as O}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as q}from"./support/fieldProperties.js";import{PopupSceneLayerView as D}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as R}from"./support/SceneLayerViewRequiredFields.js";import{updatingProgress as H}from"../support/updatingProperties.js";import L from"../../layers/SceneLayerView.js";import{TaskPriority as A}from"../../support/Scheduler.js";const V=q();let U=class extends(y(O(D(f(L))))){constructor(){super(...arguments),this.type="scene-layer-3d",this.progressiveLoadFactor=1,this._elevationContext="scene",this._isIntegratedMesh=!1,this._supportsLabeling=!0,this._interactiveEditingSessions=new Map,this._queryEngine=null}get i3slayer(){return this.layer}tryRecycleWith(e,t){return e.url===this.layer.url&&this.i3sOverrides.isEmpty?e.load(t).then((()=>{C(this.layer,e,this.i3sOverrides),this.layer=e,this.i3sOverrides.destroy();const t=this.view.resourceController?.memoryController;this.i3sOverrides=new I({view:this.view,layer:e,memoryController:t}),this.resetHighlights()})):null}get layerPopupEnabled(){return this.layer.popupEnabled}get filter(){return this._get("filter")}set filter(e){this._set("filter",j.checkSupport(e)?e:null)}get viewFilter(){const e=this.filter,t=this.layerFilter;if(i(e)&&i(t))return null;const r=this._get("viewFilter");return i(r)?new j({layerFilter:t,viewFilter:e,layerFieldsIndex:this.layer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,t)=>this.addSqlFilter(e,t,this.logError)}):(r.viewFilter=e,r.layerFilter=t,r)}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get _floorFilterClause(){const e=h(this);return s(e)?u.create(e,this.layer.fieldsIndex):null}get _excludeObjectIdsSorted(){let e=this.layer.excludeObjectIds.toArray();return c()&&this.i3sOverrides.is3DOFL&&this.i3sOverrides.geometryChangedObjectIds.length>0&&(e=e.concat(this.i3sOverrides.geometryChangedObjectIds)),e.length?e.sort(((e,t)=>e-t)):null}get _objectQualitySettings(){return this.view?.qualitySettings?.sceneService?.object}get lodFactor(){return this._objectQualitySettings?.lodFactor??1}get lodCrossfadeinDuration(){return this._objectQualitySettings.lodCrossfadeinDuration??0}get lodCrossfadeoutDuration(){return this._objectQualitySettings.lodCrossfadeoutDuration??0}get lodCrossfadeUncoveredDuration(){return this._objectQualitySettings.lodCrossfadeUncoveredDuration??0}get updatingProgressValue(){return this._controller?.updatingProgress??0}initialize(){this._fieldsHelper=new R({layerView:this}),this.updatingHandles.add((()=>this.layer.rangeInfos),(e=>this._rangeInfosChanged(e)),l),this.updatingHandles.add((()=>this.layer.renderer),(e=>this.updatingHandles.addPromise(this._rendererChange(e))),l);const e=()=>this._filterChange();this.updatingHandles.add((()=>this.parsedDefinitionExpression),e),this.updatingHandles.add((()=>this.filter),e),this.updatingHandles.add((()=>this._floorFilterClause),e),this.updatingHandles.add((()=>this._excludeObjectIdsSorted),e),this.updatingHandles.add((()=>s(this.viewFilter)?this.viewFilter.sortedObjectIds:null),e),this.updatingHandles.add((()=>s(this.viewFilter)?this.viewFilter.parsedWhereClause:null),e),this.updatingHandles.add((()=>[s(this.viewFilter)?this.viewFilter.parsedGeometry:null,s(this.filter)?this.filter.spatialRelationship:null,s(this.layer.filter)?this.layer.filter.spatialRelationship:null]),(()=>this._geometryFilterChange())),this.handles.add(this.layer.on("apply-edits",(e=>this.updatingHandles.addPromise(e.result)))),this.handles.add(this.layer.on("edits",(e=>this._handleEdits(e))))}destroy(){this._fieldsHelper=o(this._fieldsHelper)}_rangeInfosChanged(e){null!=e&&e.length>0&&r.getLogger(this.declaredClass).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return s(this.filter)?this.filter.createQuery(e):new p(e)}queryExtent(e,t){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),t?.signal)}queryFeatures(e,t){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),t?.signal).then((e=>{if(!e?.features)return e;const t=this.layer;for(const r of e.features)r.layer=t,r.sourceLayer=t;return e}))}queryObjectIds(e,t){return this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),t?.signal)}_ensureQueryEngine(){return this._queryEngine||(this._queryEngine=this._createQueryEngine()),this._queryEngine}_createQueryEngine(){const e=v(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new S({layerView:this,priority:A.FEATURE_QUERY_ENGINE,spatialIndex:new E({featureAdapter:new b({objectIdField:this.layer.objectIdField,attributeStorageInfo:this.layer.attributeStorageInfo??[],getFeatureExtent:e}),forAllFeatures:(e,t)=>this._forAllFeatures(((t,r,i)=>e({id:t,index:r,meta:i})),t,g.ALL_IN_CLIPPING_AREA),getFeatureExtent:e,sourceSpatialReference:x(this.layer),viewSpatialReference:this.view.spatialReference})})}highlight(e){const t=this._highlights;if(e instanceof p){const{set:r,handle:i}=t.acquireSet();return this.queryObjectIds(e).then((e=>t.setFeatureIds(r,e))),i}return super.highlight(e)}createInteractiveEditSession(e){return m(this._attributeEditingContext,e)}_createLayerGraphic(e){const r=new t(null,null,e);return r.layer=this.layer,r.sourceLayer=this.layer,r}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}getFilters(){const e=super.getFilters(),t=this._excludeObjectIdsSorted;return s(t)&&e.push((e=>Q(t,!1,e))),this._floorFilterClause&&this.addSqlFilter(e,this._floorFilterClause,this.logError),this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),s(this.viewFilter)&&this.viewFilter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}isUpdating(){return super.isUpdating()||this.layerFilterUpdating||s(this.viewFilter)&&this.viewFilter.updating||s(this.i3sOverrides)&&this.i3sOverrides.updating}_ensureQuery(e){return this._addDefinitionExpressionToQuery(i(e)?this.createQuery():p.from(e))}get _attributeEditingContext(){return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:this._getObjectIdField(),forEachNode:e=>this._forAllNodes((t=>s(t)?e(t.node,t.featureIds):null)),attributeStorageInfo:this.i3slayer.attributeStorageInfo??[],i3sOverrides:this.i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(e,t)=>this.setAttributeData(e,t),clearMemCache:()=>this.clearMemCache()}}_handleEdits(e){c()&&_(this._attributeEditingContext,e),F(this._attributeEditingContext,e)}get hasGeometryFilter(){const e=this.viewFilter;return s(e)&&s(e.parsedGeometry)}computeNodeFiltering(e){const t=this.viewFilter;return i(t)||!this.view.spatialReference||t.isMBSGeometryVisible(e,this.view.spatialReference,this._controller.crsIndex)?w.Unmodified:w.Culled}};e([n()],U.prototype,"i3slayer",null),e([n(H)],U.prototype,"updatingProgress",void 0),e([n({type:d})],U.prototype,"filter",null),e([n({readOnly:!0})],U.prototype,"viewFilter",null),e([n(V.requiredFields)],U.prototype,"requiredFields",null),e([n(V.availableFields)],U.prototype,"availableFields",void 0),e([n()],U.prototype,"_fieldsHelper",void 0),e([n()],U.prototype,"_floorFilterClause",null),e([n()],U.prototype,"_excludeObjectIdsSorted",null),e([n()],U.prototype,"_objectQualitySettings",null),e([n()],U.prototype,"lodFactor",null),e([n()],U.prototype,"updatingProgressValue",null),U=e([a("esri.views.3d.layers.SceneLayerView3D")],U);const P=U;export{P as default};