@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 2.7 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{__decorate as e}from"tslib";import r from"../../core/Collection.js";import{handlesGroup as t,makeHandle as i}from"../../core/handleUtils.js";import s from"../../core/Logger.js";import{debounce as a,ignoreAbortErrors as o}from"../../core/promiseUtils.js";import{sqlAnd as n,sqlNotIn as d}from"../../core/sql.js";import{property as l,subclass as p}from"../../core/accessorSupport/decorators.js";import y from"./LayerView.js";const u=Symbol();let m=class extends y{constructor(){super(...arguments),this.layerViews=new r,this._debouncedUpdate=a(async()=>{const{layer:e,parent:r}=this,t=r?.footprintLayerView;let i=[];const s=this._createQuery();if(s&&t){const{features:r}=await t.queryFeatures(s);this.suspended||(i=r.map(r=>e.acquireLayer(r)))}this.removeHandles(u),this.addHandles(i,u)})}get creatingLayerViews(){return this.view?.layerViewManager.isCreatingLayerViewsForLayer(this.layer)??!1}isUpdating(){return this.creatingLayerViews||this.layer.updating||this.layerViews.some(e=>e.updating)}enableLayerUpdates(){return t([this._updatingHandles.addWhen(()=>!1===this.parent?.footprintLayerView?.dataUpdating,()=>this.updateLayers()),this._updatingHandles.add(()=>[this.layer.maximumVisibleSublayers,this.layer.parent?.orderBy,this.parent?.footprintLayerView?.filter,this.parent?.footprintLayerView?.timeExtent,this.suspended],()=>this.updateLayers()),i(()=>this.removeHandles(u))])}updateLayers(){this.suspended?this.removeHandles(u):this._updatingHandles.addPromise(o(this._debouncedUpdate()).catch(e=>{s.getLogger(this).error(e)}))}_createQuery(){const e=this.parent?.footprintLayerView,r=this.layer?.parent;if(!e||!r||r.destroyed)return null;const{layer:{maximumVisibleSublayers:t},view:{scale:i}}=this;if(!t)return null;const{itemTypeField:s,itemSourceField:a,itemNameField:o,minScaleField:l,maxScaleField:p,objectIdField:y,orderBy:u}=r,m=n(`${l} IS NULL OR ${i} <= ${l} OR ${l} = 0`,`${p} IS NULL OR ${i} >= ${p}`),h=u?.find(e=>e.field&&!e.valueExpression),c=e.createQuery();return c.returnGeometry=!1,c.num=t,c.outFields=[y,a,o],c.where=n(c.where,m),null!=this.unsupportedItemTypes&&(c.where=n(c.where,d(s,this.unsupportedItemTypes))),h?.field&&(c.orderByFields=[`${h.field} ${"descending"===h.order?"DESC":"ASC"}`],c.outFields.push(h.field)),c}};e([l({readOnly:!0})],m.prototype,"creatingLayerViews",null),e([l()],m.prototype,"layer",void 0),e([l()],m.prototype,"layerViews",void 0),e([l({readOnly:!0})],m.prototype,"unsupportedItemTypes",void 0),e([l()],m.prototype,"parent",void 0),e([l({readOnly:!0})],m.prototype,"isUpdating",null),m=e([p("esri.views.layers.CatalogDynamicGroupLayerView")],m);export{m as default};