Skip to content

Measure toolbar

Filip Leitner edited this page Apr 30, 2024 · 3 revisions

Measure toolbar

Enable/disable

import {HsConfig} from 'hslayers-ng/config';
@Component({
  selector: 'your-app-component',
  templateUrl: 'your-app-component.html',
})
export class YourAppComponent {
  constructor(hsConfig: HsConfig) {
    this.HsConfig.update({
      componentsEnabled: {
        toolbar: true, //(true by default)
        guiOverlay: true, //(true by default)
        measureToolbar: true, //(true by default)
      },
      panelsEnabled: {
        measure: true //(false by default)
      }
    });
  }
}

If not using HslayersModule containing all components

Add HsMeasureModule import:

import {HsMeasureModule} from 'hslayers-ng/components/measure';
@NgModule({
  imports: [HsMeasureModule],
})
export class YourAppModule {}

Add HsMeasureToolbarComponent component:

import {HsMeasureToolbarComponent} from 'hslayers-ng/components/measure';
import {HsLayoutService } from 'hslayers-ng/core';

@Component({
  selector: 'your-app-component',
  templateUrl: 'your-app-component.html',
})
export class YourAppComponent {
  constructor(hsLayoutService: HsLayoutService) {
    hsLayoutService.createOverlay(HsMeasureToolbarComponent, {});
  }
}
Clone this wiki locally