@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 2.33 kB
JavaScript
import{_ as e}from"../../../../../../chunks/tslib.es6.js";import t from"../../../../../../core/Accessor.js";import{isSome as r,isNone as i}from"../../../../../../core/maybe.js";import{watch as o,sync as s}from"../../../../../../core/reactiveUtils.js";import{property as l}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{TileKey as a}from"../../../../../../layers/support/TileKey.js";import{distanceToTile as p}from"../../../../../interactive/snapping/featureSources/featureServiceSource/tileUtils.js";import{scaleBoundsPredicate as c}from"../../../../../support/layerViewUtils.js";let u=class extends t{get tiles(){const e=this.tilesCoveringView,t=r(this.pointOfInterest)?this.pointOfInterest:this.view.center;return e.sort(((e,r)=>p(t,e)-p(t,r))),e}_scaleEnabled(){return c(this.view.scale,this.layer.minScale||0,this.layer.maxScale||0)}get tilesCoveringView(){if(!this.view.ready||!this.view.featuresTilingScheme||!this.view.state||i(this.tileInfo))return[];if(!this._scaleEnabled)return[];const{spans:e,lodInfo:t}=this.view.featuresTilingScheme.getTileCoverage(this.view.state,0),{level:r}=t,o=[];for(const{row:i,colFrom:s,colTo:l}of e)for(let e=s;e<=l;e++){const s=t.normalizeCol(e),l=new a(null,r,i,s);this.tileInfo.updateTileInfo(l),o.push(l)}return o}get tileInfo(){return this.view.featuresTilingScheme?.tileInfo??null}get tileSize(){return r(this.tileInfo)?this.tileInfo.size[0]:256}constructor(e){super(e),this.pointOfInterest=null}initialize(){this.addHandles(o((()=>this.view?.state?.viewpoint),(()=>this.notifyChange("tilesCoveringView")),s))}};e([l({readOnly:!0})],u.prototype,"tiles",null),e([l({readOnly:!0})],u.prototype,"_scaleEnabled",null),e([l({readOnly:!0})],u.prototype,"tilesCoveringView",null),e([l({readOnly:!0})],u.prototype,"tileInfo",null),e([l({readOnly:!0})],u.prototype,"tileSize",null),e([l({constructOnly:!0})],u.prototype,"view",void 0),e([l({constructOnly:!0})],u.prototype,"layer",void 0),e([l()],u.prototype,"pointOfInterest",void 0),u=e([n("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiles2D")],u);export{u as FeatureServiceTiles2D};