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

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

  private viewer;

  constructor(
    private viewerService: ViewerService,
  ) { }

  ngOnInit(): void {
    this.viewer = this.viewerService.initViewer('container', {
      sceneMode: smart3d.SceneMode.SCENE3D,
      scene3DOnly: true,
      terrainProvider: smart3d.TerrainManager.createWorldTerrain(),
      baseMapMode: smart3d.BaseMapMode.ESRI,
      helper: false,
    });
  }

  addHexagonalGridImagery() {
    const lineColor = new Cesium.Color(17 / 255, 54 / 255, 212 / 255, 0.5 / 1);
    const hexagonalGridImageryProvider = new smart3d.HexagonalGridImageryProvider({
      color: lineColor,
      lineWidth: 3,
      cells: 32,
      backgroundColor: Cesium.Color.BLACK.withAlpha(0.0),
      canvasSize: 2048,
      tileWidth: 2048,
      tileHeight: 2048,
    });
    this.viewer.imageryLayers.addImageryProvider(hexagonalGridImageryProvider);
  }
}
