UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 1.75 kB
class t{constructor(){this.version=0,this.source=!1,this.targets={feature:!1,aggregate:!1},this.storage={filters:!1,data:!1},this.mesh=!1,this.queryFilter=!1,this.why={mesh:[],source:[]}}static create(e){const s=new t;for(const t in e){const r=e[t];if("object"==typeof r)for(const e in r){const a=r[e];s[t][e]=a}s[t]=r}return s}static empty(){return t.create({})}static all(){return t.create({source:!0,targets:{feature:!0,aggregate:!0},storage:{filters:!0,data:!0},mesh:!0})}unset(t){this.version=t.version,t.source&&(this.source=!1),t.targets.feature&&(this.targets.feature=!1),t.targets.aggregate&&(this.targets.aggregate=!1),t.storage.filters&&(this.storage.filters=!1),t.storage.data&&(this.storage.data=!1),t.mesh&&(this.mesh=!1),t.queryFilter&&(this.queryFilter=!1)}any(){return this.source||this.mesh||this.storage.filters||this.storage.data||this.targets.feature||this.targets.aggregate||this.queryFilter}describe(){let t=0,e="";if(this.mesh){t+=20,e+="-> (20) Mesh needs update\n";for(const t of this.why.mesh)e+=` + ${t}\n`}if(this.source){t+=10,e+="-> (10) The source needs update\n";for(const t of this.why.source)e+=` + ${t}\n`}this.targets.feature&&(t+=5,e+="-> (5) Feature target parameters changed\n"),this.storage.filters&&(t+=5,e+="-> (5) Feature filter parameters changed\n"),this.targets.aggregate&&(t+=4,e+="-> (4) Aggregate target parameters changed\n"),this.storage.data&&(t+=1,e+="-> (1) Texture storage parameters changed");const s=t<5?"Fastest":t<10?"Fast":t<15?"Moderate":t<20?"Slow":"Very Slow";console.debug(`Applying ${s} update of cost ${t}/45 `),console.debug(e)}toJSON(){return{queryFilter:this.queryFilter,source:this.source,targets:this.targets,storage:this.storage,mesh:this.mesh}}}export{t as UpdateToken};