adjuster-simple-panel.component.ts 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import {Component, ViewRef} from '@angular/core';
  2. import {HsLayoutService, HsPanelBaseComponent} from 'hslayers-ng';
  3. import {AdjusterLegendService} from '../adjuster-legend.service';
  4. import {AdjusterPresetsService} from '../adjuster-presets.service';
  5. import {AdjusterService} from '../adjuster.service';
  6. import {AdjusterUIService} from '../adjuster-ui.service';
  7. import {obceIndexLayer} 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 extends HsPanelBaseComponent {
  14. name = 'adjuster-simple';
  15. data: any;
  16. errorMsg: string;
  17. //method: string;
  18. viewRef: ViewRef;
  19. constructor(
  20. public adjUIService: AdjusterUIService,
  21. public adjusterLegendService: AdjusterLegendService,
  22. public adjusterPresetsService: AdjusterPresetsService,
  23. public adjusterService: AdjusterService,
  24. public hsLayoutService: HsLayoutService
  25. ) {
  26. super(hsLayoutService);
  27. }
  28. isVisible(): boolean {
  29. return this.hsLayoutService.panelVisible('adjuster-simple');
  30. }
  31. /**
  32. * enables index calculation and map layer
  33. * disables clusters calculation and map layers
  34. */
  35. selectIndex() {
  36. /* disable/enable calculation */
  37. this.adjusterService.allowIndex = true;
  38. this.adjusterService.allowClusters = false;
  39. /* disable/enable map layers */
  40. obceIndexLayer.setVisible(true);
  41. for (const method of this.adjusterService.methods) {
  42. method.layer?.setVisible(false);
  43. }
  44. }
  45. /**
  46. * disables index calculation and map layer
  47. * enables clusters calculation an map layers
  48. */
  49. selectClusters() {
  50. /* disable/enable calculation */
  51. this.adjusterService.allowIndex = false;
  52. this.adjusterService.allowClusters = true;
  53. /* disable/enable map layers */
  54. obceIndexLayer.setVisible(false);
  55. for (const method of this.adjusterService.methods) {
  56. method.layer?.setVisible(true);
  57. }
  58. }
  59. }