UNPKG

igniteui-angular-core

Version:

Ignite UI Angular Core logic used in multiple UI components.

102 lines (101 loc) 3.02 kB
import { EventEmitter } from '@angular/core'; import { delegateCombine } from './type'; import { ItfConverter as ItfConverter_internal } from "./ItfConverter"; import { IgxAsyncCompletedEventArgs } from './igx-async-completed-event-args'; import { Uri } from './Uri'; /** * Class for converting Itf files into enumerable triangulations. */ export class IgxTriangulationDataSource { constructor() { this._zoneRunner = null; this._importCompleted = null; this._implementation = this.createImplementation(); this._implementation.externalObject = this; this.onImplementationCreated(); } createImplementation() { return new ItfConverter_internal(); } get i() { return this._implementation; } onImplementationCreated() { } _provideImplementation(i) { this._implementation = i; this._implementation.externalObject = this; this.onImplementationCreated(); } /** * Gets the string path specifying the location of the Itf file. */ get source() { if (this.i.source == null) return null; return this.i.source.value; } /** * Sets the string path specifying the location of the Itf file. */ set source(v) { if (v == null) { this.i.source = null; } else { this.i.source = new Uri(0, v); } } /** * Gets the point data. */ getPointData() { let iv = this.i.getPointData(); return iv._inner; } /** * Gets the triangle data. */ getTriangleData() { let iv = this.i.getTriangleData(); return iv._inner; } findByName(name) { if (this.findEphemera) { if (name && name.indexOf("@@e:") == 0) { return this.findEphemera(name); } } return null; } _runInZone(act) { if (this._zoneRunner != null) { this._zoneRunner(act); } else { act(); } } /** * Event raised when the import operation has completed */ get importCompleted() { if (this._importCompleted == null) { this._importCompleted = new EventEmitter(); this.i.importCompleted = delegateCombine(this.i.importCompleted, (o, e) => { this._runInZone(() => { let outerArgs = new IgxAsyncCompletedEventArgs(); outerArgs._provideImplementation(e); if (this.beforeImportCompleted) { this.beforeImportCompleted(this, outerArgs); } this._importCompleted.emit({ sender: this, args: outerArgs }); }); }); } return this._importCompleted; } }