IntegratedMeshLayer.js 4.9 KB

12345
  1. /*
  2. All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. See https://js.arcgis.com/4.25/esri/copyright.txt for details.
  4. */
  5. import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Error.js";import r from"../core/Handles.js";import{get as o,isSome as i,isNone as s}from"../core/maybe.js";import{MultiOriginJSONMixin as a}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as n}from"../core/promiseUtils.js";import{on as p,sync as d}from"../core/reactiveUtils.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as y}from"../core/accessorSupport/decorators/subclass.js";import{persistable as l}from"../core/accessorSupport/decorators/persistable.js";import h from"./Layer.js";import{APIKeyMixin as f}from"./mixins/APIKeyMixin.js";import{ArcGISService as u}from"./mixins/ArcGISService.js";import{OperationalLayer as v}from"./mixins/OperationalLayer.js";import{PortalLayer as S}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as g}from"./mixins/ScaleRangeLayer.js";import{SceneService as j,SaveOperationType as w}from"./mixins/SceneService.js";import{elevationInfo as _}from"./support/commonProperties.js";import{I3SNodePageDefinition as T,I3SMaterialDefinition as x,I3STextureSetDefinition as L,I3SGeometryDefinition as I}from"./support/I3SLayerDefinitions.js";import O from"./support/SceneModifications.js";import{f as M}from"../chunks/persistableUrlUtils.js";let b=class extends(j(u(v(S(g(a(f(h)))))))){constructor(...e){super(...e),this._handles=new r,this.geometryType="mesh",this.operationalLayerType="IntegratedMeshLayer",this.type="integrated-mesh",this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.profile="mesh-pyramids",this.modifications=null,this._modificationsSource=null,this.elevationInfo=null,this.path=null}destroy(){this._handles.destroy()}initialize(){this._handles.add(p((()=>this.modifications),"after-changes",(()=>this.modifications=this.modifications),d))}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}readModifications(e,t,r){this._modificationsSource={url:M(e,r),context:r}}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}async _doLoad(e){const t=o(e,"signal");try{await this.loadFromPortal({supportedTypes:["Scene Service"]},e)}catch(r){n(r)}if(await this._fetchService(t),i(this._modificationsSource)){const t=await O.fromUrl(this._modificationsSource.url,this.spatialReference,e);this.setAtOrigin("modifications",t,this._modificationsSource.context.origin),this._modificationsSource=null}await this._fetchIndexAndUpdateExtent(this.nodePages,t)}beforeSave(){if(!s(this._modificationsSource))return this.load().then((()=>{}),(()=>{}))}async saveAs(e,t){return this._debouncedSaveOperations(w.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"integrated-mesh"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"integrated-mesh"};return this._debouncedSaveOperations(w.SAVE,e)}validateLayer(e){if(e.layerType&&"IntegratedMesh"!==e.layerType)throw new t("integrated-mesh-layer:layer-type-not-supported","IntegratedMeshLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new t("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x"});if(this.version.major>1)throw new t("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x"})}_getTypeKeywords(){return["IntegratedMeshLayer"]}};e([m({type:String,readOnly:!0})],b.prototype,"geometryType",void 0),e([m({type:["show","hide"]})],b.prototype,"listMode",void 0),e([m({type:["IntegratedMeshLayer"]})],b.prototype,"operationalLayerType",void 0),e([m({json:{read:!1},readOnly:!0})],b.prototype,"type",void 0),e([m({type:T,readOnly:!0})],b.prototype,"nodePages",void 0),e([m({type:[x],readOnly:!0})],b.prototype,"materialDefinitions",void 0),e([m({type:[L],readOnly:!0})],b.prototype,"textureSetDefinitions",void 0),e([m({type:[I],readOnly:!0})],b.prototype,"geometryDefinitions",void 0),e([m({readOnly:!0})],b.prototype,"serviceUpdateTimeStamp",void 0),e([m({type:O}),l({origins:["web-scene","portal-item"],type:"resource",prefix:"modifications"})],b.prototype,"modifications",void 0),e([c(["web-scene","portal-item"],"modifications")],b.prototype,"readModifications",null),e([m(_)],b.prototype,"elevationInfo",void 0),e([m({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],b.prototype,"path",void 0),b=e([y("esri.layers.IntegratedMeshLayer")],b);const A=b;export{A as default};