File

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

Description

This drawer is responsible of drawing polylines as primitives. This drawer is more efficient than PolylineDrawerService when drawing dynamic polylines.

Extends

PrimitivesDrawerService

Index

Properties
Methods

Constructor

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

Methods

add
add(cesiumProps: any)
Inherited from BasicDrawerService
Parameters :
Name Type Optional
cesiumProps any No
Returns : any
update
update(cesiumObject: any, cesiumProps: any)
Inherited from BasicDrawerService
Parameters :
Name Type Optional
cesiumObject any No
cesiumProps any No
Returns : void
withColorMaterial
withColorMaterial(cesiumProps: any)
Parameters :
Name Type Optional
cesiumProps any No
Returns : any
getShow
getShow()
Inherited from PrimitivesDrawerService
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
setPropsAssigner
setPropsAssigner(assigner: Function)
Inherited from BasicDrawerService
Parameters :
Name Type Optional
assigner Function No
Returns : void

Properties

Protected _cesiumCollection
Type : any
Inherited from PrimitivesDrawerService
Private _primitiveCollectionWrap
Type : any
Inherited from PrimitivesDrawerService
Protected _propsAssigner
Type : Function
Inherited from BasicDrawerService
Private _show
Default value : true
Inherited from PrimitivesDrawerService
import { Injectable } from '@angular/core';
import { PolylineCollection, Color, Material } from 'cesium';
import { CesiumService } from '../../cesium/cesium.service';
import { PrimitivesDrawerService } from '../primitives-drawer/primitives-drawer.service';

/**
 *  This drawer is responsible of drawing polylines as primitives.
 *  This drawer is more efficient than PolylineDrawerService when drawing dynamic polylines.
 */
@Injectable()
export class PolylinePrimitiveDrawerService extends PrimitivesDrawerService {
  constructor(cesiumService: CesiumService) {
    super(PolylineCollection, cesiumService);
  }

  add(cesiumProps: any) {
    return this._cesiumCollection.add(this.withColorMaterial(cesiumProps));
  }

  update(cesiumObject: any, cesiumProps: any) {
    if (cesiumProps.material instanceof Color) {
      if (cesiumObject.material && cesiumObject.material.uniforms &&
        cesiumObject.material.uniforms.color instanceof Color) {
        this.withColorMaterial(cesiumProps);
      } else if (!cesiumObject.material.uniforms.color.equals(cesiumProps.material)) {
        cesiumObject.material.uniforms.color = cesiumProps.material;
      }
    }
    super.update(cesiumObject, cesiumProps);
  }

  withColorMaterial(cesiumProps: any) {
    if (cesiumProps.material instanceof Color) {
      const material = Material.fromType('Color');
      material.uniforms.color = cesiumProps.material;
      cesiumProps.material = material;
    }

    return cesiumProps;
  }
}

results matching ""

    No results matching ""