UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 2.36 kB
import{_ as e}from"../../../../../../chunks/tslib.es6.js";import{HandleOwner as t}from"../../../../../../core/HandleOwner.js";import{isSome as r,isNone as i}from"../../../../../../core/maybe.js";import{watch as s,initial as o}from"../../../../../../core/reactiveUtils.js";import{property as n}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/accessorSupport/ensureType.js";import"../../../../../../core/arrayUtils.js";import{subclass as l}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{TileKey as p}from"../../../../../../layers/support/TileKey.js";import{Visibility as a}from"../../../../layers/support/FeatureTileDescriptor3D.js";import{distanceToTile as c}from"../../../../../interactive/snapping/featureSources/featureServiceSource/tileUtils.js";let u=class extends t{get tiles(){const e=this.tilesCoveringView,t=this._effectivePointOfInterest;if(r(t)){const r=e.map((e=>c(t,e)));for(let i=1;i<r.length;i++)if(r[i-1]>r[i])return e.sort(((e,r)=>c(t,e)-c(t,r))),e.slice()}return e}get tilesCoveringView(){return this._filterTiles(this.view.featureTiles?.tiles?.toArray()).map(f)}get tileInfo(){return this.view.featureTiles?.tilingScheme.toTileInfo()??null}get tileSize(){return this.view.featureTiles?.tileSize??256}get _effectivePointOfInterest(){const e=this.pointOfInterest;return r(e)?e:this.view.pointsOfInterest?.focus.location}constructor(e){super(e),this.pointOfInterest=null}initialize(){this.handles.add(s((()=>this.view.featureTiles),(e=>{this.handles.remove(v),e&&this.handles.add(e.addClient(),v)}),o))}_filterTiles(e){if(i(e))return[];return e.filter((e=>Math.abs(e.measures.screenRect[3]-e.measures.screenRect[1])>m&&e.measures.visibility===a.VISIBLE_ON_SURFACE))}};function f({lij:[e,t,r],extent:i}){return new p(`${e}/${t}/${r}`,e,t,r,i)}e([n({readOnly:!0})],u.prototype,"tiles",null),e([n({readOnly:!0})],u.prototype,"tilesCoveringView",null),e([n({readOnly:!0})],u.prototype,"tileInfo",null),e([n({readOnly:!0})],u.prototype,"tileSize",null),e([n({constructOnly:!0})],u.prototype,"view",void 0),e([n()],u.prototype,"pointOfInterest",void 0),e([n()],u.prototype,"_effectivePointOfInterest",null),u=e([l("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiles3D")],u);const m=50,v="feature-tiles";export{u as FeatureServiceTiles3D};