File

projects/angular-cesium/src/lib/cesium-extender/collections/html.ts

Index

Properties
Methods
Accessors

Properties

Private _collection
_collection: HtmlPrimitive[]
Type : HtmlPrimitive[]
Default value : []

Methods

add
add(options: any)
Parameters :
Name Type Optional
options any No
Returns : HtmlPrimitive
contains
contains(html: HtmlPrimitive)
Parameters :
Name Type Optional
html HtmlPrimitive No
Returns : boolean
destroy
destroy()
Returns : void
get
get(index: number)
Parameters :
Name Type Optional
index number No
Returns : any
remove
remove(html: HtmlPrimitive)
Parameters :
Name Type Optional
html HtmlPrimitive No
Returns : boolean
removeAll
removeAll()
Returns : void
update
update()
Returns : void

Accessors

length
getlength()
import { HtmlPrimitive } from '../primitives';

export class HtmlCollection {
  private _collection: HtmlPrimitive[] = [];

  get length() {
    return this._collection.length;
  }

  get(index: number) {
    return this._collection[index];
  }

  add(options: any): HtmlPrimitive {
    const html = new HtmlPrimitive(options, this);
    this._collection.push(html);

    return html;
  }

  remove(html: HtmlPrimitive): boolean {
    const index = this._collection.indexOf(html);
    if (index === (-1)) {
      return false;
    }

    this._collection[index].remove();
    this._collection.splice(index, 1);
    return true;
  }

  update() {
    for (let i = 0, len = this._collection.length; i < len; i++) {
      this._collection[i].update();
    }
  }

  removeAll() {
    while (this._collection.length > 0) {
      const html = this._collection.pop();
      html.remove();
    }
  }

  contains(html: HtmlPrimitive): boolean {
    return Cesium.defined(html) && html.collection === this;
  }

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

result-matching ""

    No results matching ""