1 |
- import{_ as t,$ as s,a0 as d,cp as q,c1 as A,cE as O,cA as I,ar as x,ct as V,cF as C,g as N,R as y,cG as h,cH as U,Y as j,aH as L,cI as _,N as E,a1 as M,s as T,b5 as P}from"./index.6c049565.js";import{i as H}from"./utils.eb2c3fd5.js";let v=class extends q{get version(){return this.commitVersionProperties(),(this._get("version")||0)+1}};t([s({readOnly:!0})],v.prototype,"version",null),v=t([d("esri.views.layers.support.ClipArea")],v);const b=v;var w;let l=w=class extends b{constructor(e){super(e),this.type="rect",this.left=null,this.right=null,this.top=null,this.bottom=null}clone(){return new w({left:this.left,right:this.right,top:this.top,bottom:this.bottom})}commitVersionProperties(){this.commitProperty("left"),this.commitProperty("right"),this.commitProperty("top"),this.commitProperty("bottom")}};t([s({type:[Number,String],json:{write:!0}})],l.prototype,"left",void 0),t([s({type:[Number,String],json:{write:!0}})],l.prototype,"right",void 0),t([s({type:[Number,String],json:{write:!0}})],l.prototype,"top",void 0),t([s({type:[Number,String],json:{write:!0}})],l.prototype,"bottom",void 0),l=w=t([d("esri.views.layers.support.ClipRect")],l);const k=l;var R;const D={base:O,key:"type",typeMap:{extent:I,polygon:x}};let g=R=class extends b{constructor(e){super(e),this.type="geometry",this.geometry=null}clone(){var e,r;return new R({geometry:(r=(e=this.geometry)==null?void 0:e.clone())!=null?r:null})}commitVersionProperties(){this.commitProperty("geometry")}};t([s({types:D,json:{read:A,write:!0}})],g.prototype,"geometry",void 0),g=R=t([d("esri.views.layers.support.Geometry")],g);const F=g;let m=class extends b{constructor(e){super(e),this.type="path",this.path=[]}commitVersionProperties(){this.commitProperty("path")}};t([s({type:[[[Number]]],json:{write:!0}})],m.prototype,"path",void 0),m=t([d("esri.views.layers.support.Path")],m);const z=m,f=V.ofType({key:"type",base:null,typeMap:{rect:k,path:z,geometry:F}}),Y=e=>{let r=class extends e{constructor(){super(...arguments),this.attached=!1,this.clips=new f,this.lastUpdateId=-1,this.moving=!1,this.updateRequested=!1,this.visibleAtCurrentScale=!1}initialize(){var p,c,S,$;const i=(c=(p=this.view)==null?void 0:p.spatialReferenceLocked)!=null?c:!0;((S=this.view)==null?void 0:S.spatialReference)&&i&&!this.spatialReferenceSupported?this.addResolvingPromise(Promise.reject(new N("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",{layer:this.layer}))):(this.container||(this.container=new H),this.container.fadeTransitionEnabled=!0,this.container.visible=!1,this.container.endTransitions(),this.handles.add([y(()=>this.suspended,a=>{this.container&&(this.container.visible=!a),this.view&&!a&&this.updateRequested&&this.view.requestUpdate()},h),y(()=>{var a,u;return(u=(a=this.layer)==null?void 0:a.opacity)!=null?u:1},a=>{this.container&&(this.container.opacity=a)},h),y(()=>this.layer&&"blendMode"in this.layer?this.layer.blendMode:"normal",a=>{this.container&&(this.container.blendMode=a)},h),y(()=>this.layer&&"effect"in this.layer?this.layer.effect:null,a=>{this.container&&(this.container.effect=a)},h),U(()=>this.clips,"change",()=>{this.container&&(this.container.clips=this.clips)},h),y(()=>{var a;return{scale:(a=this.view)==null?void 0:a.scale,scaleRange:this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null}},({scale:a})=>{const u=a&&this.isVisibleAtScale(a);u!==this.visibleAtCurrentScale&&this._set("visibleAtCurrentScale",u)},h)]),($=this.view)!=null&&$.whenLayerView?this.view.whenLayerView(this.layer).then(a=>{a===this&&this.processAttach()},()=>{}):this.when().then(()=>{this.processAttach()},()=>{}))}destroy(){this.processDetach(),this.updateRequested=!1}get spatialReferenceSupported(){var o;const i=(o=this.view)==null?void 0:o.spatialReference;return i==null||this.supportsSpatialReference(i)}get updating(){var i;return this.spatialReferenceSupported&&(!this.attached||!this.suspended&&(this.updateRequested||this.isUpdating())||!!((i=this.updatingHandles)!=null&&i.updating))}processAttach(){this.isResolved()&&!this.attached&&!this.destroyed&&this.spatialReferenceSupported&&(this.attach(),this.attached=!0,this.requestUpdate())}processDetach(){this.attached&&(this.attached=!1,this.detach(),this.updateRequested=!1)}isVisibleAtScale(i){const o=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;if(!o)return!0;const{minScale:p,maxScale:c}=o;return(p===0||i<=p)&&(c===0||i>=c)}requestUpdate(){this.destroyed||this.updateRequested||(this.updateRequested=!0,this.suspended||this.view.requestUpdate())}processUpdate(i){!this.isFulfilled()||this.isResolved()?(this._set("updateParameters",i),this.updateRequested&&!this.suspended&&(this.updateRequested=!1,this.update(i))):this.updateRequested=!1}hitTest(i,o){return Promise.resolve(null)}supportsSpatialReference(i){return!0}canResume(){return!!this.spatialReferenceSupported&&!!super.canResume()&&this.visibleAtCurrentScale}getSuspendInfo(){const i=super.getSuspendInfo(),o=!this.spatialReferenceSupported,p=this.visibleAtCurrentScale;return o&&(i.spatialReferenceNotSupported=o),p&&(i.outsideScaleRange=p),i}};return t([s()],r.prototype,"attached",void 0),t([s({type:f,set(i){const o=C(i,this._get("clips"),f);this._set("clips",o)}})],r.prototype,"clips",void 0),t([s()],r.prototype,"container",void 0),t([s()],r.prototype,"moving",void 0),t([s({readOnly:!0})],r.prototype,"spatialReferenceSupported",null),t([s({readOnly:!0})],r.prototype,"updateParameters",void 0),t([s()],r.prototype,"updateRequested",void 0),t([s()],r.prototype,"updating",null),t([s()],r.prototype,"view",void 0),t([s({readOnly:!0})],r.prototype,"visibleAtCurrentScale",void 0),r=t([d("esri.views.2d.layers.LayerView2D")],r),r};let n=class extends j(L(_(E.EventedMixin(M)))){constructor(e){super(e),this.layer=null,this.parent=null}initialize(){this.when().catch(e=>{if(e.name!=="layerview:create-error"){const r=this.layer&&this.layer.id||"no id",i=this.layer&&this.layer.title||"no title";T.getLogger(this.declaredClass).error("#resolve()",`Failed to resolve layer view (layer title: '${i}', id: '${r}')`,e)}})}get fullOpacity(){return P(this.get("layer.opacity"),1)*P(this.get("parent.fullOpacity"),1)}get suspended(){return!this.canResume()}get suspendInfo(){return this.getSuspendInfo()}get legendEnabled(){var e;return!this.suspended&&((e=this.layer)==null?void 0:e.legendEnabled)===!0}get updating(){var e;return!(!((e=this.updatingHandles)!=null&&e.updating)&&!this.isUpdating())}get updatingProgress(){return this.updating?0:1}get visible(){var e;return((e=this.layer)==null?void 0:e.visible)===!0}set visible(e){this._overrideIfSome("visible",e)}canResume(){var e,r,i;return this.visible&&((e=this.layer)==null?void 0:e.loaded)&&!((r=this.parent)!=null&&r.suspended)&&((i=this.view)==null?void 0:i.ready)||!1}getSuspendInfo(){const e=this.parent&&this.parent.suspended?this.parent.suspendInfo:{},r=this;return r.view&&r.view.ready||(e.viewNotReady=!0),this.layer&&this.layer.loaded||(e.layerNotLoaded=!0),this.visible||(e.layerInvisible=!0),e}isUpdating(){return!1}};t([s()],n.prototype,"fullOpacity",null),t([s()],n.prototype,"layer",void 0),t([s()],n.prototype,"parent",void 0),t([s({readOnly:!0})],n.prototype,"suspended",null),t([s({readOnly:!0})],n.prototype,"suspendInfo",null),t([s({readOnly:!0})],n.prototype,"legendEnabled",null),t([s({type:Boolean,readOnly:!0})],n.prototype,"updating",null),t([s({readOnly:!0})],n.prototype,"updatingProgress",null),t([s()],n.prototype,"visible",null),t([s()],n.prototype,"view",void 0),n=t([d("esri.views.layers.LayerView")],n);const J=n;export{J as u,Y as y};
|