@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 3.15 kB
JavaScript
import{_ as e}from"../../chunks/tslib.es6.js";import s from"../../Color.js";import o from"../../Graphic.js";import t from"../../core/Accessor.js";import{lerp as r}from"../../core/mathUtils.js";import{isSome as l,isNone as i}from"../../core/maybe.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import h from"../../symbols/PointSymbol3D.js";import c from"../../symbols/SimpleFillSymbol.js";import p from"../../symbols/TextSymbol.js";import y from"../../symbols/TextSymbol3DLayer.js";const m=[[0,179,255],[117,62,128],[0,104,255],[215,189,166],[32,0,193],[98,162,206],[102,112,129],[52,125,0],[142,118,246],[138,83,0],[92,122,255],[122,55,83],[0,142,255],[81,40,179],[0,200,244],[13,24,127],[0,170,147],[19,58,241],[22,44,35]];let b=class extends t{constructor(e){super(e),this.updating=!1,this.enablePolygons=!0,this.enableLabels=!0,this._polygons=new Map,this._labels=new Map,this._enabled=!0}initialize(){this._symbols=m.map((e=>new c({color:[e[0],e[1],e[2],.6],outline:{color:"black",width:1}}))),this.update()}destroy(){this._enabled=!1,this.clear()}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this.update())}update(){if(!this._enabled)return void this.clear();const e=e=>{if(l(e.label))return e.label;let s=e.lij.toString();return l(e.loadPriority)&&(s+=` (${e.loadPriority})`),s},t=this.getTiles(),a=new Array,n=new Set((this._labels.size,this._labels.keys()));t.forEach(((c,m)=>{const b=c.lij.toString();n.delete(b);const d=c.lij[0],g=c.geometry;if(this.enablePolygons&&!this._polygons.has(b)){const e=new o({geometry:g,symbol:this._symbols[d%this._symbols.length]});this._polygons.set(b,e),a.push(e)}if(this.enableLabels){const n=e(c),d=m/(t.length-1),u=r(0,200,d),_=r(20,6,d)/.75,f=l(c.loadPriority)&&c.loadPriority>=t.length,w=new s([u,f?0:u,f?0:u]),j="3d"===this.view.type?()=>new h({verticalOffset:{screenLength:40/.75},callout:{type:"line",color:"white",border:{color:"black"}},symbolLayers:[new y({text:n,halo:{color:"white",size:1/.75},material:{color:w},size:_})]}):()=>new p({text:n,haloColor:"white",haloSize:1/.75,color:w,size:_}),v=this._labels.get(b);if(v){const e=j();(i(v.symbol)||JSON.stringify(e)!==JSON.stringify(v.symbol))&&(v.symbol=e)}else{const e=new o({geometry:g.extent.center,symbol:j()});this._labels.set(b,e),a.push(e)}}}));const c=new Array;n.forEach((e=>{const s=this._polygons.get(e);null!=s&&(c.push(s),this._polygons.delete(e));const o=this._labels.get(e);null!=o&&(c.push(o),this._labels.delete(e))})),this.view.graphics.removeMany(c),this.view.graphics.addMany(a)}clear(){this.view.graphics.removeMany(Array.from(this._polygons.values())),this.view.graphics.removeMany(Array.from(this._labels.values())),this._polygons.clear(),this._labels.clear()}};e([a({constructOnly:!0})],b.prototype,"view",void 0),e([a({readOnly:!0})],b.prototype,"updating",void 0),e([a()],b.prototype,"enabled",null),b=e([n("esri.views.support.TileTreeDebugger")],b);export{b as TileTreeDebugger};