@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 3.89 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../request.js";import i from"../core/Error.js";import r from"../core/Logger.js";import{MultiOriginJSONSupportMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as o}from"../core/promiseUtils.js";import{property as a,subclass as l}from"../core/accessorSupport/decorators.js";import p from"../geometry/Extent.js";import n from"../geometry/SpatialReference.js";import m from"./Layer.js";import{APIKeyMixin as y}from"./mixins/APIKeyMixin.js";import{ArcGISService as u}from"./mixins/ArcGISService.js";import{CustomParametersMixin as c}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as d}from"./mixins/OperationalLayer.js";import{PortalLayer as h}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as f}from"./mixins/ScaleRangeLayer.js";import{url as S,elevationInfo as v}from"./support/commonProperties.js";import{default3DTilesFullExtent as x,default3DTilesSpatialReference as g,initFullExtent as j,hasEsriCrs as w}from"./support/tiles3DUtils.js";import{logInvalidElevationInfoWarning as E,elevationModeRequiredMessage as L,featureExpressionUnsupportedMessage as R}from"../support/elevationInfoUtils.js";let T=class extends(u(d(h(f(s(c(y(m)))))))){constructor(e){super(e),this.operationalLayerType="GaussianSplatLayer",this.type="gaussian-splat",this.opacity=1,this.minScale=0,this.maxScale=0,this.url=null,this.rootTilesetJSON=null,this.fullExtent=x,this.spatialReference=g,this.esriCrsSpatialReference=null,this.esriCrsFullExtent=null}get supportedSpatialReferences(){return this.initialized&&this.esriCrsSpatialReference?[g,this.esriCrsSpatialReference]:[g]}get fullExtents(){return this.initialized&&this.esriCrsFullExtent?[x,this.esriCrsFullExtent]:[x]}set elevationInfo(e){null!=e&&"absolute-height"!==e.mode||this._set("elevationInfo",e),this._validateElevationInfo(e)}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}async _doLoad(e){const r=null!=e?e.signal:null;try{await this.loadFromPortal({supportedTypes:["3DTiles Service"],validateItem:e=>{if(e.typeKeywords?.includes("GaussianSplat"))return!0;throw new i("portal:invalid-layer-item-type","Invalid layer item, expected '${expectedType}' ",{expectedType:"3DTiles Service"})}},e)}catch(s){o(s)}if(this.url){const e=t(this.url,{query:{...this.customParameters,token:this.apiKey},responseType:"json",signal:r}).then(e=>{this.rootTilesetJSON=e.data,this.fullExtent=j(this.rootTilesetJSON,!1);w(this.rootTilesetJSON)&&(this.esriCrsFullExtent=j(this.rootTilesetJSON,!0),this.esriCrsSpatialReference=this.esriCrsFullExtent.spatialReference,this.spatialReference=this.esriCrsSpatialReference)},e=>{o(e)});await e}}_validateElevationInfo(e){const t="Gaussian Splat layers";E(r.getLogger(this),L(t,"absolute-height",e)),E(r.getLogger(this),R(t,e))}};e([a({type:["GaussianSplatLayer"]})],T.prototype,"operationalLayerType",void 0),e([a({readOnly:!0})],T.prototype,"type",void 0),e([a({readOnly:!0,json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}}})],T.prototype,"opacity",void 0),e([a({type:Number,json:{name:"layerDefinition.minScale",write:!0,origins:{service:{read:!1,write:!1}}}})],T.prototype,"minScale",void 0),e([a({type:Number,json:{name:"layerDefinition.maxScale",write:!0,origins:{service:{read:!1,write:!1}}}})],T.prototype,"maxScale",void 0),e([a(S)],T.prototype,"url",void 0),e([a({type:p})],T.prototype,"fullExtent",void 0),e([a({type:n})],T.prototype,"spatialReference",void 0),e([a({readOnly:!0})],T.prototype,"supportedSpatialReferences",null),e([a({type:[p]})],T.prototype,"fullExtents",null),e([a({type:["show","hide"]})],T.prototype,"listMode",void 0),e([a(v)],T.prototype,"elevationInfo",null),T=e([l("esri.layers.GaussianSplatLayer")],T);const C=T;export{C as default};