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

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

  private profile;
  public result = [];

  constructor(
    private viewerService: ViewerService,
  ) {
  }

  ngOnInit() {
  }

  startProfileAnalyze() {
    const viewer = this.viewerService.viewer;
    this.profile = new smart3d.Profile(viewer);
    this.profile.computedEvent.addEventListener(positions => {
      this.result = positions;
    });

    // 需要开启
    viewer.scene.globe.depthTestAgainstTerrain = true;
    this.profile.start();
  }
}
