thematic-earth
Version:
HTML-based, whole-Earth thematic maps using locally hosted data layers
2 lines • 1.83 kB
JavaScript
/* Copyright (c) 2023 Read Write Tools. Legal use subject to the Thematic Earth Software License Agreement. */
import expect from'../dev/expect.js';const Static={nextLayerId:0};Object.seal(Static);export default class Layer{constructor(e,t,i,s,a,l,n,r,h,c,b){expect(e,'ThematicEarthElement'),expect(t,'Number'),expect(i,'Number'),expect(s,'String'),expect(a,'String'),expect(l,'String'),expect(n,'String'),expect(r,'String'),expect(h,['Function','null']),expect(c,'String'),expect(b,'String'),this.thematicEarthElement=e,this.layerId=Static.nextLayerId++,this.spatialId=t,this.zOrder=i,this.layerName=s,this.tessIdentifier=a,this.tessClassname=l,this.featureKey=n,this.identifiable=r,this.identifyCallback=h,this.selectable=c,this.wantsLabels=b,this.visible=!0,this.layerNeedsRestyling=!0,Object.seal(this)}isVisible(){return this.visible}changeVisibility(e){expect(e,'Boolean'),this.visible=e,this.layerNeedsRestyling=!0,this.thematicEarthElement.earth.invalidateCanvas()}getIdentifiable(){return this.identifiable}isIdentifiable(){return 1==this.visible&&'yes'==this.identifiable}changeIdentifiability(e){expect(e,'Boolean'),this.identifiable=1==e?'yes':'no'}getSelectable(){return this.selectable}isSelectable(){return 1==this.visible&&'yes'==this.selectable}changeSelectability(e){expect(e,'Boolean'),this.selectable=1==e?'yes':'no'}getLabelable(){return this.wantsLabels}isLabelable(){return 1==this.visible&&'yes'==this.wantsLabels}changeLabelability(e){expect(e,'Boolean'),this.wantsLabels=1==e?'yes':'no',this.thematicEarthElement.earth.invalidateCanvas()}reconfigLayer(e){expect(e,'Object'),this.layerName=e.layerName??this.layerName,this.tessIdentifier=e.tessIdentifier??this.tessIdentifier,this.tessClassname=e.tessClassname??this.tessClassname,this.featureKey=e.featureKey??this.featureKey,this.layerNeedsRestyling=!0}}