Viewer Configuration

ViewerConfiguration Service for setting the initial Cesium viewer options.

  • The service must be provided by component that defined <ac-map/> or any components higher in the hierarchy.

  • use viewerOptions and viewerModifier() to initialise the Cesium Viewer.

demo-map.component.html
demo-map.component.ts
demo-map.component.html
@Component({
selector: 'demo-map',
templateUrl: './demo-map.component.html',
providers: [ViewerConfiguration], // Don't forget to Provide it
})
export class DemoMapComponent {
constructor(private viewerConf: ViewerConfiguration) {
// viewerOptions will be passed the Cesium.Viewer contstuctor
viewerConf.viewerOptions = {
selectionIndicator: false,
timeline: false,
infoBox: false,
fullscreenButton: false,
baseLayerPicker: false,
animation: false,
shouldAnimate: false,
homeButton: false,
geocoder: false,
navigationHelpButton: false,
navigationInstructionsInitiallyVisible: false,
mapMode2D: Cesium.MapMode2D.ROTATE,
};
// Will be called on viewer initialistion
viewerConf.viewerModifier = (viewer: any) => {
// Remove default double click zoom behaviour
viewer.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
};
}
}
demo-map.component.ts
<ac-map id="main-map"></ac-map>