UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 9 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as e}from"tslib";import t from"../../../../core/Error.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{EsriPromise as i}from"../../../../core/Promise.js";import{initial as s,watch as o,sync as n,whenOnce as l}from"../../../../core/reactiveUtils.js";import{property as a,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as h}from"../../../../core/support/UpdatingHandles.js";import{FeatureTileController3D as u}from"../../../../layers/graphics/controllers/FeatureTileController3D.js";import{symbolHasExtrudeSymbolLayer as d}from"../../../../symbols/support/utils.js";import{elevationAlignPointsInFeatures as c}from"./elevationAlignPointsInFeatures.js";import{Graphics3DFeatureProcessor as y}from"./Graphics3DFeatureProcessor.js";import{QueryEngine as g}from"./QueryEngine.js";import{QueryEngineContext as m}from"./QueryEngineContext.js";import{queryForSymbologySnapping as f}from"./queryForSymbologySnapping.js";import{HeatmapFeatureProcessor as w}from"../support/HeatmapFeatureProcessor.js";import{LayerViewPerformanceInfo as E}from"../support/LayerViewPerformanceInfo.js";import{hasLayerBasedScaleVisibility as b}from"../../../support/layerViewUtils.js";import{TaskPriority as V}from"../../../support/Scheduler.js";let F=class extends i{constructor(e){super(e),this._dataUpdatingState=0,this.graphicsQuery={queryForSymbologySnapping:async(e,t)=>this.symbologySnappingSupported?f(this.graphics3DProcessor,e,t):{candidates:[],sourceCandidateIndices:[]},executeQuery:(e,t)=>this.queryEngine.executeQuery(e,t),executeQueryForIds:(e,t)=>this.queryEngine.executeQueryForIds(e,t),executeQueryForCount:(e,t)=>this.queryEngine.executeQueryForCount(e,t),executeQueryForExtent:(e,t)=>this.queryEngine.executeQueryForExtent(e,t),executeQueryForLatestObservations:(e,t)=>this.queryEngine.executeQueryForLatestObservations(e,t),executeAttributeBinsQuery:(e,t)=>this.queryEngine.executeAttributeBinsQuery(e,t)},this.controller=null,this.updatingHandles=new h,this._controllerCreated=!1,this._pendingController=null}initialize(){this.addResolvingPromise(this._initializeController()),this.updatingHandles.add(()=>this.layer.renderer,e=>this._recreateProcessor(e),s),this.updatingHandles.add(()=>this.updatePolicy,e=>this.processor.preferredUpdatePolicy=e);const{layer:e,view:t,hasM:r,hasZ:i}=this,{spatialReference:o,resourceController:n}=t,l=new m(o,e,n,()=>this.processor.featureStore,i,r);this.queryEngine=new g({context:l,priority:V.FEATURE_QUERY_ENGINE})}destroy(){this.removeAllHandles(),this.updatingHandles.destroy(),this._destroyPendingController(),this.controller=r(this.controller),this.processor=r(this.processor),this.queryEngine=r(this.queryEngine),this.loadedGraphics=null}_destroyPendingController(){this._pendingController=r(this._pendingController)}get updating(){return this.updatingHandles.updating||!this._controllerCreated||this.controller?.updating||this.processor?.updating}get legendEnabled(){return this.processor.legendEnabled}get layer(){return this.layerView.layer}get layerViewUid(){return this.layerView.uid}get view(){return this.layerView.view}get hasZ(){return this.layerView.hasZ}get hasM(){return this.layerView.hasM}get fullOpacity(){return this.layerView.fullOpacity}get suspended(){return this.layerView.suspended}get filter(){return"filter"in this.layerView?this.layerView.filter:null}get effectiveDisplayFilter(){return"effectiveDisplayFilter"in this.layerView?this.layerView.effectiveDisplayFilter:null}get highlightIds(){return"highlightIds"in this.layerView?this.layerView.highlightIds:null}get slicePlaneEnabled(){return this.layerView.slicePlaneEnabled}get featureSpatialReference(){return"featureSpatialReference"in this.layerView?this.layerView.featureSpatialReference:null}get graphics3DProcessor(){return"graphics-3d"===this.processor?.type?this.processor:null}get heatmapProcessor(){return"heatmap"===this.processor?.type?this.processor:null}get hasAllFeatures(){return!(!this.controller||!("hasAllFeatures"in this.controller))&&this.controller.hasAllFeatures}get hasAllFeaturesInView(){return!(!this.controller||!("hasAllFeaturesInView"in this.controller))&&this.controller.hasAllFeaturesInView}get hasFullGeometries(){return!(!this.controller||!("hasFullGeometries"in this.controller))&&this.controller.hasFullGeometries}get symbologySnappingSupported(){return this.layer?.renderer?.symbols?.some(d)??!1}get updatePolicy(){return 1}get scaleVisibilitySuspended(){return this.processor?.scaleVisibilitySuspended}get timeExtent(){return"timeExtent"in this.layerView?this.layerView.timeExtent:null}get dataUpdating(){return 0!==this._dataUpdatingState}get suspendInfo(){return this.processor?.suspendInfo??{}}forEachGraphic(e){this.loadedGraphics.forEach(e)}findGraphic(e){return this.loadedGraphics.find(e)}queryObjectIds(e,t){return this.layerView.queryObjectIds(e,t)}whenGraphicBounds(e,t){return this.processor?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor?.computeAttachmentOrigin(e,t)}async elevationAlignPointsInFeatures(e,r){const i=this.graphics3DProcessor;if(null==i)throw new t("featurelayerview3d:missing-processor","A Graphics3D processor is needed to resolve graphics elevation.");return c(this.view,this.layer,e=>i.getGraphics3DGraphicByObjectId(e),e,r)}highlightByGraphics(e,t){return this.processor.highlightByGraphics(e,t)}highlightByObjectIds(e,t){return this.processor.highlightByObjectIds(e,this.layer.objectIdField,t)}maskOccludee(e){return this.processor.maskOccludee(e)}notifyContentGeometryUpdate(){this.layerView.emit("visible-geometry-changed")}async _initializeController(){const e=this.createController();this._pendingController=e,this._setupDataUpdating(e),await e.when(),this._setControllerWhenInitialized(e)}_setupDataUpdating(e){"dataUpdating"in e&&this.addHandles([o(()=>e.dataUpdating,e=>{e&&0===this._dataUpdatingState?this._dataUpdatingState=1:e||1!==this._dataUpdatingState||(this._dataUpdatingState=0)},n),o(()=>!!this.graphics3DProcessor?.dataUpdating,t=>{t&&1===this._dataUpdatingState?this._dataUpdatingState=2:t||2!==this._dataUpdatingState||(this._dataUpdatingState=e.dataUpdating?1:0)},n)])}async _setControllerWhenInitialized(e){try{await this.when()}catch(t){}this._controllerCreated=!0,this.isResolved()&&!this.destroyed?(await l(()=>this.view?.groundView?.ready),this.beforeSetController(e),this._pendingController=null,this.controller=e,this.loadedGraphics=e.graphics):this._destroyPendingController()}_recreateProcessor(e){const t="heatmap"===e?.type,r="heatmap"===this.processor?.type,i=this.processor;if(i&&t===r)return;const s=t?new w({owner:this}):new y({owner:this,frustumVisibilityEnabled:!0,scaleVisibilityEnabled:!b(),filterVisibilityEnabled:!0,timeExtentEnabled:!0,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!0,preferredUpdatePolicy:this.updatePolicy,updateClippingExtent:e=>this._updateClippingExtent(e)});this.processor=s,i?.destroy(),this.queryEngine?.clear(),this.addResolvingPromise(s.when())}_updateClippingExtent(e){if(this.clippingExtent=e,!this.controller)return!1;switch(this.controller.type){case"stream":return!1;case"feature-tile-3d":return this.controller.extent=e,!0}}get usedMemory(){return this.processor?.usedMemory??0}get performanceInfo(){const e=this.controller instanceof u?this.controller:null;return new E(this.usedMemory,this.loadedGraphics?.length,e?.serviceDataCount??-1,e?.maximumNumberOfFeatures??-1,0,this.processor.performanceInfo)}};e([a()],F.prototype,"updating",null),e([a()],F.prototype,"legendEnabled",null),e([a()],F.prototype,"layerView",void 0),e([a()],F.prototype,"layer",null),e([a()],F.prototype,"layerViewUid",null),e([a()],F.prototype,"view",null),e([a()],F.prototype,"hasZ",null),e([a()],F.prototype,"hasM",null),e([a()],F.prototype,"fullOpacity",null),e([a()],F.prototype,"suspended",null),e([a()],F.prototype,"filter",null),e([a()],F.prototype,"effectiveDisplayFilter",null),e([a()],F.prototype,"highlightIds",null),e([a()],F.prototype,"slicePlaneEnabled",null),e([a()],F.prototype,"featureSpatialReference",null),e([a()],F.prototype,"loadedGraphics",void 0),e([a()],F.prototype,"graphics3DProcessor",null),e([a()],F.prototype,"heatmapProcessor",null),e([a()],F.prototype,"hasAllFeatures",null),e([a()],F.prototype,"hasAllFeaturesInView",null),e([a()],F.prototype,"hasFullGeometries",null),e([a()],F.prototype,"symbologySnappingSupported",null),e([a()],F.prototype,"updatePolicy",null),e([a()],F.prototype,"scaleVisibilitySuspended",null),e([a()],F.prototype,"timeExtent",null),e([a()],F.prototype,"_dataUpdatingState",void 0),e([a({readOnly:!0})],F.prototype,"dataUpdating",null),e([a()],F.prototype,"controller",void 0),e([a()],F.prototype,"processor",void 0),e([a()],F.prototype,"updatingHandles",void 0),e([a()],F.prototype,"_controllerCreated",void 0),F=e([p("esri.views.3d.layers.graphics.Graphics3DGraphicsPipeline")],F);export{F as Graphics3DGraphicsPipeline};