@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 2.34 kB
JavaScript
import{_ as r}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Logger.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{WhereClause as o}from"../../../../core/sql/WhereClause.js";import{findFieldsCaseInsensitive as n}from"../i3s/I3SUtil.js";const t=t=>{let a=class extends t{constructor(){super(...arguments),this._definitionExpressionErrors=0,this._maxDefinitionExpressionErrors=20,this.logError=r=>{this._definitionExpressionErrors<this._maxDefinitionExpressionErrors&&e.getLogger(this.declaredClass).error("Error while evaluating definitionExpression: "+r),this._definitionExpressionErrors++,this._definitionExpressionErrors===this._maxDefinitionExpressionErrors&&e.getLogger(this.declaredClass).error("Further errors are ignored")}}get parsedDefinitionExpression(){if(!this.i3slayer||!this.i3slayer.definitionExpression)return null;try{const r=o.create(this.i3slayer.definitionExpression,this.i3slayer.fieldsIndex);if(!r.isStandardized)return e.getLogger(this.declaredClass).error("definitionExpression is using non standard function"),null;const i=[],s=r.fieldNames;return n(s,this.i3slayer.fields,{missingFields:i}),i.length>0?(e.getLogger(this.declaredClass).error(`definitionExpression references unknown fields: ${i.join(", ")}`),null):(this._definitionExpressionErrors=0,r)}catch(r){return e.getLogger(this.declaredClass).error("Failed to parse definitionExpression: "+r),null}}get definitionExpressionFields(){return this.parsedDefinitionExpression?this.parsedDefinitionExpression.fieldNames:[]}_evaluateClause(r,e){try{return r.testFeature(e)}catch(i){return this.logError(i),!1}}_addDefinitionExpressionToQuery(r){if(!this.parsedDefinitionExpression)return r;const e=this.i3slayer.definitionExpression,i=r.clone();return i.where?i.where=`(${e}) AND (${i.where})`:i.where=e,i}};return r([i()],a.prototype,"i3slayer",void 0),r([i({readOnly:!0})],a.prototype,"parsedDefinitionExpression",null),r([i({readOnly:!0})],a.prototype,"definitionExpressionFields",null),a=r([s("esri.views.3d.layers.support.DefinitionExpressionSceneLayerView")],a),a};export{t as DefinitionExpressionSceneLayerView};