File

projects/angular-cesium/src/lib/angular-cesium/services/viewer-factory/viewer-factory.service.ts

Index

Properties
Methods

Constructor

constructor()

Methods

createViewer
createViewer(mapContainer: HTMLElement, options?: any)

Creates a viewer with default or custom options

Parameters :
Name Type Optional Description
mapContainer HTMLElement No
  • container to initialize the viewer on
options any Yes
  • Options to create the viewer with - Optional
Returns : any

new viewer

Properties

cesium
cesium: any
Type : any
import { Injectable } from '@angular/core';

@Injectable()
export class ViewerFactory {
  cesium: any;


  constructor() {
    this.cesium = Cesium;
  }

  /**
   * Creates a viewer with default or custom options
   * @param mapContainer - container to initialize the viewer on
   * @param options - Options to create the viewer with - Optional
   *
   * @returns new viewer
   */
  createViewer(mapContainer: HTMLElement, options?: any) {
    let viewer = null;
    if (options) {
      viewer = new this.cesium.Viewer(mapContainer, {
        contextOptions: {
          webgl: {preserveDrawingBuffer: true}
        },
        ...options
      });
    } else {
      viewer = new this.cesium.Viewer(mapContainer,
        {
          contextOptions: {
            webgl: {preserveDrawingBuffer: true}
          },
        });
    }

    return viewer;
  }
}

result-matching ""

    No results matching ""