projects/angular-cesium/src/lib/angular-cesium/services/viewer-factory/viewer-factory.service.ts
Properties |
Methods |
constructor()
|
createViewer | ||||||||||||
createViewer(mapContainer: HTMLElement, options?: any)
|
||||||||||||
Creates a viewer with default or custom options
Parameters :
Returns :
any
new viewer |
cesium |
cesium:
|
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;
}
}