File

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

Description

This drawer is responsible for creating the static version of the polyline component. This also allows us to change the color of the polylines.

Index

Methods

Constructor

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

Methods

update
update(primitive: any, geometryProps: any, instanceProps: any, primitiveProps: any)

Update function can only change the primitive color.

Parameters :
Name Type Optional
primitive any No
geometryProps any No
instanceProps any No
primitiveProps any No
Returns : any
import { Injectable } from '@angular/core';
import { CesiumService } from '../../../cesium/cesium.service';
import { StaticPrimitiveDrawer } from '../static-primitive-drawer/static-primitive-drawer.service';

/**
 *  This drawer is responsible for creating the static version of the polyline component.
 *  This also allows us to change the color of the polylines.
 */
@Injectable()
export class StaticPolylineDrawerService extends StaticPrimitiveDrawer {
  constructor(cesiumService: CesiumService) {
    super(Cesium.PolylineGeometry, cesiumService);
  }

  /**
   * Update function can only change the primitive color.
   */
  update(primitive: any, geometryProps: any, instanceProps: any, primitiveProps: any) {
    const color = instanceProps.attributes.color.value;

    if (primitive.ready) {
      primitive.getGeometryInstanceAttributes().color = color;
    } else {
      Cesium.when(primitive.readyPromise).then((readyPrimitive: any) => {
        readyPrimitive.getGeometryInstanceAttributes().color.value = color;
      });
    }

    return primitive;
  }
}

result-matching ""

    No results matching ""