projects/angular-cesium/src/lib/angular-cesium/services/drawers/polyline-primitive-drawer/polyline-primitive-drawer.service.ts
This drawer is responsible of drawing polylines as primitives. This drawer is more efficient than PolylineDrawerService when drawing dynamic polylines.
Properties |
|
Methods |
constructor(cesiumService: CesiumService)
|
||||||
Parameters :
|
add | ||||||
add(cesiumProps: any)
|
||||||
Inherited from
BasicDrawerService
|
||||||
Defined in
BasicDrawerService:16
|
||||||
Parameters :
Returns :
any
|
update |
update(cesiumObject: any, cesiumProps: any)
|
Inherited from
BasicDrawerService
|
Defined in
BasicDrawerService:20
|
Returns :
void
|
withColorMaterial | ||||||
withColorMaterial(cesiumProps: any)
|
||||||
Parameters :
Returns :
any
|
getShow |
getShow()
|
Inherited from
PrimitivesDrawerService
|
Defined in
PrimitivesDrawerService:51
|
Returns :
boolean
|
init |
init()
|
Inherited from
BasicDrawerService
|
Defined in
BasicDrawerService:19
|
Returns :
void
|
remove | ||||||
remove(entity: any)
|
||||||
Inherited from
BasicDrawerService
|
||||||
Defined in
BasicDrawerService:38
|
||||||
Parameters :
Returns :
void
|
removeAll |
removeAll()
|
Inherited from
BasicDrawerService
|
Defined in
BasicDrawerService:42
|
Returns :
void
|
setShow | ||||||
setShow(showValue: boolean)
|
||||||
Inherited from
BasicDrawerService
|
||||||
Defined in
BasicDrawerService:46
|
||||||
Parameters :
Returns :
void
|
setPropsAssigner | ||||||
setPropsAssigner(assigner: Function)
|
||||||
Inherited from
BasicDrawerService
|
||||||
Defined in
BasicDrawerService:23
|
||||||
Parameters :
Returns :
void
|
Protected _cesiumCollection |
Type : any
|
Inherited from
PrimitivesDrawerService
|
Defined in
PrimitivesDrawerService:12
|
Private _primitiveCollectionWrap |
Type : any
|
Inherited from
PrimitivesDrawerService
|
Defined in
PrimitivesDrawerService:11
|
Protected _propsAssigner |
Type : Function
|
Inherited from
BasicDrawerService
|
Defined in
BasicDrawerService:13
|
Private _show |
Default value : true
|
Inherited from
PrimitivesDrawerService
|
Defined in
PrimitivesDrawerService:10
|
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;
}
}