adjuster-simple-panel.component.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import {Component, ViewRef} from '@angular/core';
  2. import {HsLayoutService} from 'hslayers-ng';
  3. import {HsPanelComponent} from 'hslayers-ng';
  4. import {AdjusterPresetsService} from '../adjuster-presets.service';
  5. import {AdjusterService} from '../adjuster.service';
  6. import {AdjusterUIService} from '../adjuster-ui.service';
  7. import {nuts3IndexLayer} from '../../app.config';
  8. @Component({
  9. selector: 'pra-adjuster-simple',
  10. templateUrl: './adjuster-simple-panel.component.html',
  11. styleUrls: ['./adjuster-simple-panel.component.scss'],
  12. })
  13. export class AdjusterSimplePanelComponent implements HsPanelComponent {
  14. name = 'adjuster-simple';
  15. data: any;
  16. errorMsg: string;
  17. //method: string;
  18. viewRef: ViewRef;
  19. constructor(
  20. public adjUIService: AdjusterUIService,
  21. public adjusterPresetsService: AdjusterPresetsService,
  22. public adjusterService: AdjusterService,
  23. public hsLayoutService: HsLayoutService
  24. ) {}
  25. isVisible(): boolean {
  26. return this.hsLayoutService.panelVisible('adjuster-simple');
  27. }
  28. /**
  29. * enables index calculation and map layer
  30. * disables clusters calculation an map layers
  31. */
  32. selectIndex() {
  33. /* disable/enable calculation */
  34. this.adjusterService.allowIndex = true;
  35. this.adjusterService.allowClusters = false;
  36. /* disable/enable map layers */
  37. nuts3IndexLayer.setVisible(true);
  38. for (const method of this.adjusterService.methods) {
  39. method.layer?.setVisible(false);
  40. }
  41. }
  42. /**
  43. * disables index calculation and map layer
  44. * enables clusters calculation an map layers
  45. */
  46. selectClusters() {
  47. /* disable/enable calculation */
  48. this.adjusterService.allowIndex = false;
  49. this.adjusterService.allowClusters = true;
  50. /* disable/enable map layers */
  51. nuts3IndexLayer.setVisible(false);
  52. for (const method of this.adjusterService.methods) {
  53. method.layer?.setVisible(true);
  54. }
  55. }
  56. }