File

projects/angular-cesium/src/lib/angular-cesium/services/drawers/czml-drawer/czml-drawer.service.ts

Description

This drawer is responsible for drawing czml dataSources.

Index

Properties
Methods

Constructor

constructor(cesiumService: CesiumService)
Parameters :
Name Type Optional
cesiumService CesiumService No

Methods

add
add(cesiumProps: any)
Parameters :
Name Type Optional
cesiumProps any No
Returns : any
init
init(options?: EntitiesDrawerOptions)
Parameters :
Name Type Optional
options EntitiesDrawerOptions Yes
Returns : {}
remove
remove(entity: any)
Parameters :
Name Type Optional
entity any No
Returns : void
removeAll
removeAll()
Returns : void
setShow
setShow(showValue: boolean)
Parameters :
Name Type Optional
showValue boolean No
Returns : void
update
update(entity: any, cesiumProps: any)
Parameters :
Name Type Optional
entity any No
cesiumProps any No
Returns : void

Properties

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

import { CesiumService } from '../../cesium/cesium.service';
import { BasicDrawerService } from '../basic-drawer/basic-drawer.service';
import { EntitiesDrawerOptions } from '../../../models/entities-drawer-options';

/**
 *  This drawer is responsible for drawing czml dataSources.
 */
@Injectable()
export class CzmlDrawerService extends BasicDrawerService {

  czmlStream: any;

  constructor(
    private cesiumService: CesiumService,
  ) {
    super();
  }


  init(options?: EntitiesDrawerOptions) {
    const dataSources = [];

    this.czmlStream = new Cesium.CzmlDataSource('czml');

    dataSources.push(this.czmlStream);

    this.cesiumService.getViewer().dataSources.add(this.czmlStream);

    return dataSources;
  }

  // returns the packet, provided by the stream
  add(cesiumProps: any): any {

    this.czmlStream.process(cesiumProps.czmlPacket);

    return cesiumProps;
  }

  update(entity: any, cesiumProps: any) {
    this.czmlStream.process(cesiumProps.czmlPacket);
  }

  remove(entity: any) {
    this.czmlStream.entities.removeById(entity.acEntity.id);
  }

  removeAll() {
    this.czmlStream.entities.removeAll();
  }

  setShow(showValue: boolean) {
    this.czmlStream.entities.show = showValue;
  }

}


result-matching ""

    No results matching ""