Angular Cesium extends cesium api and expose additional features, but if you want to use pure cesium api, you can do so by using the MapsManagerService
.
This service is a singleton that allow you to get the ac-map
anywhere in your app.
With the map component you can receive cesium viewer
or any other util service that was created by ac-map
.
@Component({selector: 'my-component',})export class MyComponent {constructor(mapsManagerService: MapsManagerService)// Get default map valuesconst viewer = mapsManagerService.getMap().getCesiumViewer();const mapEventManager = mapsManagerService.getMap().getMapEventsManager();const cameraService = mapsManagerService.getMap().getCameraService();​// Get map by id nameconst viewer = mapsManagerService.getMap('secondery-map').getCesiumViewer();​}
get(mapId?: string)
Retrieve a specific map by id.
If mapId
not provided then the first map is returned, for use cases when you have only one ac-map instance
Service that initialize cesium viewer and expose cesium viewer and scene.
Provided and created by the ac-map
component, so each map has it own CesiumService
instance. Therefore can only be injected to components under the <ac-map/>
hierarchy.
@Component({selector: 'tracks-layer',})export class TracksLayerComponent implements OnInit {​constructor(private cesiumService: CesiumService) {// return the cesium viewerconst viewer = this.cesiumService.getViewer()// return the cesium sceneconst scene = this.cesiumService.getScene()// return the cesium canvasconst canvas = this.cesiumService.getCanvas()// return the AcMapComponentconst acMap = this.cesiumSerice.getMap()}​}​