app.component.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import {Component} from '@angular/core';
  2. import {
  3. HsConfig,
  4. HsEventBusService,
  5. HsLanguageService,
  6. HsLayoutService,
  7. HsPanelContainerService,
  8. HsSidebarService,
  9. HsToastService,
  10. } from 'hslayers-ng';
  11. import {AppService} from './app.service';
  12. import {CalculatorComponent} from './calculator/calculator.component';
  13. @Component({
  14. selector: 'application-root',
  15. templateUrl: './app.component.html',
  16. styleUrls: ['./app.component.scss'],
  17. })
  18. export class AppComponent {
  19. /* You can name your app as you like or not at all */
  20. title = 'hslayers-application';
  21. constructor(
  22. private appService: AppService,
  23. /* Inject here all modules from HSLayers-NG which you intend to use */
  24. public hsConfig: HsConfig,
  25. private hsEventBus: HsEventBusService,
  26. private hsLanguageService: HsLanguageService,
  27. private hsLayoutService: HsLayoutService,
  28. public hsPanelContainerService: HsPanelContainerService,
  29. public hsSidebarService: HsSidebarService,
  30. private hsToastService: HsToastService
  31. ) {
  32. /* Create new button in the sidebar */
  33. this.hsSidebarService.addButton({
  34. panel: 'calculator',
  35. module: 'calculator',
  36. order: 0,
  37. title: 'Field Calculator', //() =>
  38. //this.hsLanguageService.getTranslation('ADJUSTER.adjustFactors'),
  39. description: 'Adjust factors for computation',
  40. icon: 'icon-analytics-piechart',
  41. });
  42. /* Create new panel itself */
  43. this.hsPanelContainerService.create(CalculatorComponent, {});
  44. /* Switch language to cs */
  45. this.hsEventBus.layoutLoads.subscribe(() => {
  46. this.hsLanguageService.setLanguage('en');
  47. this.hsLayoutService.setDefaultPanel('calculator');
  48. });
  49. }
  50. }