IntegratedMeshLayer.528c5a58.js 5.5 KB

1
  1. import{_ as t,$ as a,ar as S,dN as O,a0 as u,cp as $,dm as N,id as x,ji as b,aY as L,iw as M,ct as R,bP as I,U as A,eJ as w,eB as J,eC as j,eD as D,ih as U,eE as K,ii as P,am as V,cH as E,dg as q,bQ as z,aM as C,a as G,t as k,g as d,cK as B,il as F,cu as H}from"./index.6c049565.js";import{g as m}from"./persistable.1b6e46c5.js";import{N as Q,L as v}from"./SceneService.54334498.js";import{s as Y,l as W,u as X,m as Z}from"./I3SLayerDefinitions.a8db72f6.js";import"./multiOriginJSONSupportUtils.38b69b9c.js";import"./originUtils.2d0aad75.js";import"./resourceUtils.60052bdf.js";var h;let n=h=class extends ${constructor(e){super(e),this.geometry=null,this.type="clip"}writeGeometry(e,i,r,o){if(o.layer&&o.layer.spatialReference&&!o.layer.spatialReference.equals(this.geometry.spatialReference)){if(!N(e.spatialReference,o.layer.spatialReference))return void(o&&o.messages&&o.messages.push(new x("scenemodification:unsupported","Scene modifications with incompatible spatial references are not supported",{modification:this,spatialReference:o.layer.spatialReference,context:o})));const l=new S;b(e,l,o.layer.spatialReference),i[r]=l.toJSON(o)}else i[r]=e.toJSON(o);delete i[r].spatialReference}clone(){return new h({geometry:L(this.geometry),type:this.type})}};t([a({type:S}),m()],n.prototype,"geometry",void 0),t([O(["web-scene","portal-item"],"geometry")],n.prototype,"writeGeometry",null),t([a({type:["clip","mask","replace"],nonNullable:!0}),m()],n.prototype,"type",void 0),n=h=t([u("esri.layers.support.SceneModification")],n);const c=n;var p;let y=p=class extends M(R.ofType(c)){constructor(e){super(e),this.url=null}clone(){return new p({url:this.url,items:this.items.map(e=>e.clone())})}toJSON(e){return this.toArray().map(i=>i.toJSON(e)).filter(i=>!!i.geometry)}static fromJSON(e,i){const r=new p;for(const o of e)r.add(c.fromJSON(o,i));return r}static async fromUrl(e,i,r){const o={url:I(e),origin:"service"},l=await A(e,{responseType:"json",signal:w(r,"signal")}),T=i.toJSON(),f=[];for(const g of l.data)f.push(c.fromJSON({...g,geometry:{...g.geometry,spatialReference:T}},o));return new p({url:e,items:f})}};t([a({type:String})],y.prototype,"url",void 0),y=p=t([u("esri.layers.support.SceneModifications")],y);const _=y;let s=class extends Q(J(j(D(U(K(P(H))))))){constructor(...e){super(...e),this._handles=new V,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(E(()=>this.modifications,"after-changes",()=>this.modifications=this.modifications,q))}normalizeCtorArgs(e,i){return typeof e=="string"?{url:e,...i}:e}readModifications(e,i,r){this._modificationsSource={url:z(e,r),context:r}}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}async _doLoad(e){const i=w(e,"signal");try{await this.loadFromPortal({supportedTypes:["Scene Service"]},e)}catch(r){C(r)}if(await this._fetchService(i),G(this._modificationsSource)){const r=await _.fromUrl(this._modificationsSource.url,this.spatialReference,e);this.setAtOrigin("modifications",r,this._modificationsSource.context.origin),this._modificationsSource=null}await this._fetchIndexAndUpdateExtent(this.nodePages,i)}beforeSave(){if(!k(this._modificationsSource))return this.load().then(()=>{},()=>{})}async saveAs(e,i){return this._debouncedSaveOperations(v.SAVE_AS,{...i,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"integrated-mesh"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"integrated-mesh"};return this._debouncedSaveOperations(v.SAVE,e)}validateLayer(e){if(e.layerType&&e.layerType!=="IntegratedMesh")throw new d("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 d("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x"});if(this.version.major>1)throw new d("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x"})}_getTypeKeywords(){return["IntegratedMeshLayer"]}};t([a({type:String,readOnly:!0})],s.prototype,"geometryType",void 0),t([a({type:["show","hide"]})],s.prototype,"listMode",void 0),t([a({type:["IntegratedMeshLayer"]})],s.prototype,"operationalLayerType",void 0),t([a({json:{read:!1},readOnly:!0})],s.prototype,"type",void 0),t([a({type:Y,readOnly:!0})],s.prototype,"nodePages",void 0),t([a({type:[W],readOnly:!0})],s.prototype,"materialDefinitions",void 0),t([a({type:[X],readOnly:!0})],s.prototype,"textureSetDefinitions",void 0),t([a({type:[Z],readOnly:!0})],s.prototype,"geometryDefinitions",void 0),t([a({readOnly:!0})],s.prototype,"serviceUpdateTimeStamp",void 0),t([a({type:_}),m({origins:["web-scene","portal-item"],type:"resource",prefix:"modifications"})],s.prototype,"modifications",void 0),t([B(["web-scene","portal-item"],"modifications")],s.prototype,"readModifications",null),t([a(F)],s.prototype,"elevationInfo",void 0),t([a({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],s.prototype,"path",void 0),s=t([u("esri.layers.IntegratedMeshLayer")],s);const ne=s;export{ne as default};