projects/angular-cesium/src/lib/cesium-extender/collections/html.ts
Properties |
|
Methods |
Accessors |
Private _collection |
_collection:
|
Type : HtmlPrimitive[]
|
Default value : []
|
add | ||||||
add(options: any)
|
||||||
Parameters :
Returns :
HtmlPrimitive
|
contains | ||||||
contains(html: HtmlPrimitive)
|
||||||
Parameters :
Returns :
boolean
|
destroy |
destroy()
|
Returns :
void
|
get | ||||||
get(index: number)
|
||||||
Parameters :
Returns :
any
|
remove | ||||||
remove(html: HtmlPrimitive)
|
||||||
Parameters :
Returns :
boolean
|
removeAll |
removeAll()
|
Returns :
void
|
update |
update()
|
Returns :
void
|
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();
}
}