You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9 lines
3.2 KiB
9 lines
3.2 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
define("../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/maybe ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/Logger ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ../../../core/libs/gl-matrix-2/math/vec2 ../../support/QueueProcessor".split(" "),function(m,h,x,p,C,D,E,y,z,A){function B(a,f){a.length=0;f.forEach(g=>a.push(g));return a}const t=new Set,q=[],n=new Map,u=[0,0];h=class extends h{constructor(a){super(a);this._keyToItem= |
|
new Map;this.concurrency=6;this.strategy="scale-first";this.tileInfoView=null}initialize(){const {concurrency:a,process:f,strategy:g}=this;this._queue=new A.QueueProcessor({concurrency:a,process:(b,d)=>{b=this._keyToItem.get(b);return f(b,{signal:d})},peeker:"scale-first"===g?b=>this._peekByScaleFirst(b):b=>this._peekByCenterFirst(b)})}destroy(){this.clear();this._queue=x.destroyMaybe(this._queue)}get length(){return this._queue?this._queue.length:0}get onGoingCount(){return this._keyToItem.size}abort(a){this._queue.abort("string"=== |
|
typeof a?a:a.id)}clear(){this._queue.clear();this._keyToItem.clear()}has(a){return"string"===typeof a?this._keyToItem.has(a):this._keyToItem.has(a.id)}isOngoing(a){a="string"===typeof a?a:a.id;return this.has(a)&&this._queue.isOngoing(a)}pause(){this._queue.pause()}push(a){const f=a.key.id;if(this._queue.has(f))return this._queue.get(f);const g=this._queue.push(f),b=()=>{this._keyToItem.delete(f)};this._keyToItem.set(f,a);g.then(b,b);return g}reset(){this._queue.reset()}resume(){this._queue.resume()}_peekByScaleFirst(a){if(!this.state)return a.values().next().value; |
|
const f=this.tileInfoView;let g=Number.NEGATIVE_INFINITY,b=Number.POSITIVE_INFINITY;a.forEach(e=>{e=this._keyToItem.get(e);const c=this.tileInfoView.getTileScale(e.key);n.has(c)||(n.set(c,[]),g=Math.max(c,g),b=Math.min(c,b));n.get(c).push(e.key);t.add(c)});let d=this.state.scale;n.has(d)||(B(q,t),q.sort((e,c)=>e-c),d=q.reduce((e,c)=>Math.abs(c-d)<Math.abs(e-d)?c:e,q[0]));d=Math.min(d,g);d=Math.max(d,b);a=n.get(d);const k=f.getClosestInfoForScale(d),l=k.getColumnForX(this.state.center[0]),r=k.getRowForY(this.state.center[1]); |
|
a.sort((e,c)=>{const v=k.denormalizeCol(e.col,e.world),w=k.denormalizeCol(c.col,c.world);return Math.sqrt((l-v)*(l-v)+(r-e.row)*(r-e.row))-Math.sqrt((l-w)*(l-w)+(r-c.row)*(r-c.row))});t.clear();n.clear();return a[0].id}_peekByCenterFirst(a){if(!this.state)return a.values().next().value;const f=this.tileInfoView,g=this.state.center;let b=Number.POSITIVE_INFINITY,d;a.forEach(k=>{k=this._keyToItem.get(k);f.getTileCoords(u,k.key);const l=z.distance(u,g);l<b&&(b=l,d=k.key)});return d.id}};m.__decorate([p.property({constructOnly:!0})], |
|
h.prototype,"concurrency",void 0);m.__decorate([p.property({constructOnly:!0})],h.prototype,"process",void 0);m.__decorate([p.property()],h.prototype,"state",void 0);m.__decorate([p.property({constructOnly:!0})],h.prototype,"strategy",void 0);m.__decorate([p.property({constructOnly:!0})],h.prototype,"tileInfoView",void 0);return h=m.__decorate([y.subclass("esri.views.2d.tiling.TileQueue")],h)}); |