import { Component, OnInit } from '@angular/core';
import { ViewerService } from 'src/app/services';

@Component({
  selector: 'app-underground',
  templateUrl: './underground.component.html',
  styleUrls: ['./underground.component.css']
})
export class UndergroundComponent implements OnInit {

  public alpha = 0.2;
  private underground;

  constructor(
    private viewerService: ViewerService,
  ) { }

  ngOnInit() {
  }

  activateUndergroundMode() {
    if (this.underground instanceof smart3d.Underground) {
      this.underground.destroy();
    }
    const viewer = this.viewerService.viewer;
    this.underground = new smart3d.Underground(viewer);
    this.underground.activate(this.alpha);
  }

  deactivateUndergroundMode() {
    this.underground.destroy();
  }
}
