Procházet zdrojové kódy

✨ switch map layers in Simple UI

jmacura před 3 roky
rodič
revize
f18af7bcd9
1 změnil soubory, kde provedl 21 přidání a 2 odebrání
  1. 21 2
      src/adjuster/adjuster-simple-panel.component.ts

+ 21 - 2
src/adjuster/adjuster-simple-panel.component.ts

@@ -6,6 +6,7 @@ import {HsPanelComponent} from 'hslayers-ng';
 import {AdjusterPresetsService} from './adjuster-presets.service';
 import {AdjusterService} from './adjuster.service';
 import {AdjusterUIService} from './adjuster-ui.service';
+import {nuts3IndexLayer} from '../app.config';
 
 @Component({
   selector: 'pra-adjuster-simple',
@@ -30,15 +31,33 @@ export class AdjusterSimplePanelComponent implements HsPanelComponent {
     return this.hsLayoutService.panelVisible('adjuster-simple');
   }
 
+  /**
+   * enables index calculation and map layer
+   * disables clusters calculation an map layers
+   */
   selectIndex() {
+    /* disable/enable calculation */
     this.adjusterService.allowIndex = true;
     this.adjusterService.allowClusters = false;
-    //TODO: disable/enable map layers
+    /* disable/enable map layers */
+    nuts3IndexLayer.setVisible(true);
+    for (const method of this.adjusterService.methods) {
+      method.layer?.setVisible(false);
+    }
   }
 
+  /**
+   * disables index calculation and map layer
+   * enables clusters calculation an map layers
+   */
   selectClusters() {
+    /* disable/enable calculation */
     this.adjusterService.allowIndex = false;
     this.adjusterService.allowClusters = true;
-    //TODO: disable/enable map layers
+    /* disable/enable map layers */
+    nuts3IndexLayer.setVisible(false);
+    for (const method of this.adjusterService.methods) {
+      method.layer?.setVisible(true);
+    }
   }
 }