@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 4.95 kB
JavaScript
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Collection.js";import r from"../../../core/CollectionFlattener.js";import{destroyMaybe as s,isSome as o,unwrap as i}from"../../../core/maybe.js";import{initial as n,when as a,watch as p}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 c}from"../../../core/accessorSupport/decorators/subclass.js";import u from"../../../rest/support/DirectionLine.js";import d from"../../../rest/support/DirectionPoint.js";import h from"../../../rest/support/PointBarrier.js";import m from"../../../rest/support/PolygonBarrier.js";import y from"../../../rest/support/PolylineBarrier.js";import f from"../../../rest/support/RouteInfo.js";import g from"../../../rest/support/Stop.js";import{LayerView3D as b}from"./LayerView3D.js";import{GraphicsProcessor as j}from"./graphics/GraphicsProcessor.js";import{toViewIfLocal as v}from"./support/projectExtentUtils.js";import{EventedSet as w}from"../support/EventedSet.js";import{UpdatePolicy as I}from"../webgl-engine/lib/UpdatePolicy.js";import S from"../../layers/LayerView.js";function _(e){return e instanceof u||e instanceof d||e instanceof h||e instanceof m||e instanceof y||e instanceof f||e instanceof g}let O=class extends(b(S)){constructor(){super(...arguments),this.type="route-3d",this.loadedGraphics=new w,this._byObjectID=new Map,this.slicePlaneEnabled=!1,this.fullExtentInLocalViewSpatialReference=null}initialize(){this._set("processor",new j({owner:this,scaleVisibilityEnabled:!0,frustumVisibilityEnabled:!0})),this.addResolvingPromise(this.processor.initializePromise),this.updatingHandles.addOnCollectionChange((()=>this._routeItems),(e=>this._routeItemsChanged(e)),n),this.addResolvingPromise(v(this).then((e=>this.fullExtentInLocalViewSpatialReference=e))),this.handles.add(a((()=>this.view?.basemapTerrain?.ready),(()=>()=>this.notifyChange("updating")),{once:!0}))}destroy(){this.handles.removeAll(),this.updatingHandles.removeAll(),this._set("processor",s(this.processor)),this._get("_routeItems")?.destroy()}get _routeItems(){return new r({getCollections:()=>[this.layer.pointBarriers,this.layer.polygonBarriers,this.layer.polylineBarriers,this.layer.stops,this.layer.directionLines,this.layer.directionPoints,o(this.layer.routeInfo)?new t([this.layer.routeInfo]):null]})}_routeItemsChanged(e){if(e.removed.length){this.loadedGraphics.removeMany(e.removed.map((e=>{const t=this._byObjectID.get(e);return this._byObjectID.delete(e),t})));for(const t of e.removed)this.handles.remove(t)}if(e.added.length){this.loadedGraphics.addMany(e.added.map((e=>{const t=e.toGraphic();return this._byObjectID.set(e,t),t})));for(const t of e.added)this.handles.add([p((()=>t.geometry),((e,r)=>{this._updateGraphic(t,"geometry",e,r)})),p((()=>t.symbol),((e,r)=>{this._updateGraphic(t,"symbol",e,r)}))],t)}}get legendEnabled(){return this.canResume()&&!this.processor?.frustumVisibilitySuspended}getSuspendInfo(){const e=super.getSuspendInfo();return e.outsideScaleRange=this.processor?.scaleVisibilitySuspended??!1,e.outsideOfView=this.processor?.frustumVisibilitySuspended??!1,e}async fetchPopupFeatures(e,t){return i(t)?.clientGraphics??[]}getHit(e){return this.processor.getHit(e)}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor?.computeAttachmentOrigin(e,t)}getSymbolLayerSize(e,t){return this.processor.getSymbolLayerSize(e,t)}async queryGraphics(){return new t(this.loadedGraphics.toArray())}maskOccludee(e){return this.processor.maskOccludee(e)}highlight(e){return _(e)&&(e=this._byObjectID.get(e)),this.processor.highlight(e)}get updatePolicy(){return this.processor?.graphicsCore.effectiveUpdatePolicy||I.SYNC}canResume(){return super.canResume()&&!this.processor?.scaleVisibilitySuspended}isUpdating(){return!(!this.processor?.updating&&this.view?.basemapTerrain?.ready)}get performanceInfo(){return{displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:-1,totalNumberOfFeatures:-1,nodes:0,core:null,updating:this.updating,elevationUpdating:this.processor?.elevationAlignment.updating??!1,visibilityFrustum:!this.processor?.frustumVisibilitySuspended}}_updateGraphic(e,t,r,s){const o=this._byObjectID.get(e);o[t]=r,V.graphic=o,V.property=t,V.oldValue=s,V.newValue=r,this.processor?.graphicsCore.graphicUpdateHandler(V)}};e([l()],O.prototype,"_routeItems",null),e([l()],O.prototype,"loadedGraphics",void 0),e([l({readOnly:!0})],O.prototype,"legendEnabled",null),e([l()],O.prototype,"layer",void 0),e([l({readOnly:!0})],O.prototype,"processor",void 0),e([l({type:Boolean})],O.prototype,"slicePlaneEnabled",void 0),O=e([c("esri.views.3d.layers.RouteLayerView3D")],O);const V={graphic:null,property:null,oldValue:null,newValue:null},G=O;export{G as default};