File

projects/angular-cesium/src/lib/angular-cesium-widgets/models/edit-polyline.ts

Extends

AcEntity

Index

Properties
Methods
Accessors

Constructor

constructor(entityId: string, startPosition: Cartesian3, endPosition: Cartesian3, polylineProps?: PolylineProps)
Parameters :
Name Type Optional
entityId string No
startPosition Cartesian3 No
endPosition Cartesian3 No
polylineProps PolylineProps Yes

Properties

Private _polylineProps
_polylineProps: PolylineProps
Type : PolylineProps
Static counter
counter: number
Type : number
Default value : 0
Private editedEntityId
editedEntityId: string
Type : string
Private id
id: string
Type : string
Private positions
positions: Cartesian3[]
Type : Cartesian3[]

Methods

Private generateId
generateId()
Returns : string
getEditedEntityId
getEditedEntityId()
Returns : string
getEndPosition
getEndPosition()
Returns : any
getId
getId()
Returns : string
getPositions
getPositions()
Returns : any[]
getPositionsCallbackProperty
getPositionsCallbackProperty()
Returns : Cartesian3[]
getStartPosition
getStartPosition()
Returns : any
setEndPosition
setEndPosition(position: Cartesian3)
Parameters :
Name Type Optional
position Cartesian3 No
Returns : void
setStartPosition
setStartPosition(position: Cartesian3)
Parameters :
Name Type Optional
position Cartesian3 No
Returns : void
validatePositions
validatePositions()
Returns : boolean
Static create
create(json?: any)
Inherited from AcEntity
Defined in AcEntity:18

Creates entity from a json

Parameters :
Name Type Optional Description
json any Yes

entity object

Returns : any

entity as AcEntity

Accessors

props
getprops()
setprops(value)
Parameters :
Name Optional
value No
Returns : void
import { AcEntity } from '../../angular-cesium/models/ac-entity';
import { Cartesian3 } from '../../angular-cesium/models/cartesian3';
import { PolylineProps } from './polyline-edit-options';

export class EditPolyline extends AcEntity {
  static counter = 0;
  private editedEntityId: string;
  private id: string;
  private positions: Cartesian3[];
  private _polylineProps: PolylineProps;

  constructor(entityId: string, startPosition: Cartesian3, endPosition: Cartesian3, polylineProps?: PolylineProps) {
    super();
    this.editedEntityId = entityId;
    this.id = this.generateId();
    this.positions = [startPosition, endPosition];
    this._polylineProps = {...polylineProps};
  }

  get props(): PolylineProps {
    return this._polylineProps;
  }

  set props(value: PolylineProps) {
    this._polylineProps = value;
  }

  getEditedEntityId(): string {
    return this.editedEntityId;
  }

  getPositions(): any[] {
    return this.positions.map(p => p.clone());
  }


  getPositionsCallbackProperty(): Cartesian3[] {
    return new Cesium.CallbackProperty(this.getPositions.bind(this), false);
  }

  validatePositions(): boolean {
    return this.positions[0] !== undefined && this.positions[1] !== undefined;
  }

  getStartPosition() {
    return this.positions[0];
  }

  getEndPosition() {
    return this.positions[1];
  }

  setStartPosition(position: Cartesian3) {
    this.positions[0] = position;
  }

  setEndPosition(position: Cartesian3) {
    this.positions[1] = position;
  }

  getId(): string {
    return this.id;
  }

  private generateId(): string {
    return 'edit-polyline-' + EditPolyline.counter++;
  }
}

result-matching ""

    No results matching ""