File

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

Description

General primitives drawer responsible of drawing Cesium primitives. Drawers the handle Cesium primitives extend it.

Extends

BasicDrawerService

Index

Properties
Methods

Constructor

constructor(drawerType: any, cesiumService: CesiumService)
Parameters :
Name Type Optional
drawerType any No
cesiumService CesiumService No

Properties

Protected _cesiumCollection
Type : any
Private _primitiveCollectionWrap
Type : any
Protected _propsAssigner
Type : Function
Inherited from BasicDrawerService
Private _show
Default value : true

Methods

add
add(cesiumProps: any, ...args: any[])
Inherited from BasicDrawerService
Parameters :
Name Type Optional
cesiumProps any No
args any[] No
Returns : any
getShow
getShow()
Returns : boolean
init
init()
Inherited from BasicDrawerService
Returns : void
remove
remove(entity: any)
Inherited from BasicDrawerService
Parameters :
Name Type Optional
entity any No
Returns : void
removeAll
removeAll()
Inherited from BasicDrawerService
Returns : void
setShow
setShow(showValue: boolean)
Inherited from BasicDrawerService
Parameters :
Name Type Optional
showValue boolean No
Returns : void
update
update(entity: any, cesiumProps: any, ...args: any[])
Inherited from BasicDrawerService
Parameters :
Name Type Optional
entity any No
cesiumProps any No
args any[] No
Returns : void
setPropsAssigner
setPropsAssigner(assigner: Function)
Inherited from BasicDrawerService
Parameters :
Name Type Optional
assigner Function No
Returns : void
import { PrimitiveCollection } from 'cesium';
import { CesiumService } from '../../cesium/cesium.service';
import { BasicDrawerService } from '../basic-drawer/basic-drawer.service';

/**
 *  General primitives drawer responsible of drawing Cesium primitives.
 *  Drawers the handle Cesium primitives extend it.
 */
export abstract class PrimitivesDrawerService extends BasicDrawerService {
  private _show = true;
  private _primitiveCollectionWrap: any;
  protected _cesiumCollection: any;
  protected _propsAssigner: Function;

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

  init() {
    this._cesiumCollection = new this.drawerType();
    this._primitiveCollectionWrap = new PrimitiveCollection();
    this._primitiveCollectionWrap.add(this._cesiumCollection);
    this.cesiumService.getScene().primitives.add(this._primitiveCollectionWrap);
  }

  add(cesiumProps: any, ...args: any[]): any {
    return this._cesiumCollection.add(cesiumProps);
  }

  update(entity: any, cesiumProps: any, ...args: any[]) {
    if (this._propsAssigner) {
      this._propsAssigner(entity, cesiumProps);
    } else {
      Object.assign(entity, cesiumProps);
    }
  }

  remove(entity: any) {
    this._cesiumCollection.remove(entity);
  }

  removeAll() {
    this._cesiumCollection.removeAll();
  }

  setShow(showValue: boolean) {
    this._show = showValue;
    this._primitiveCollectionWrap.show = showValue;
  }

  getShow(): boolean {
    return this._show;
  }
}

results matching ""

    No results matching ""