import { delegateCombine, delegateRemove } from './type';
import { ItfConverter as ItfConverter_internal } from "./ItfConverter";
import { IgcAsyncCompletedEventArgs } from './igc-async-completed-event-args';
import { Uri } from './Uri';
/**
 * Class for converting Itf files into enumerable triangulations.
*/
export class IgcTriangulationDataSource {
    constructor() {
        //@@ZoneRunner
        this._importCompleted = null;
        this._importCompleted_wrapped = 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;
    }
    /**
     * Event raised when the import operation has completed
    */
    get importCompleted() {
        return this._importCompleted;
    }
    set importCompleted(ev) {
        if (this._importCompleted_wrapped !== null) {
            this.i.importCompleted = delegateRemove(this.i.importCompleted, this._importCompleted_wrapped);
            this._importCompleted_wrapped = null;
            this._importCompleted = null;
        }
        this._importCompleted = ev;
        this._importCompleted_wrapped = (o, e) => {
            let outerArgs = new IgcAsyncCompletedEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeImportCompleted) {
                this.beforeImportCompleted(this, outerArgs);
            }
            if (this._importCompleted) {
                this._importCompleted(this, outerArgs);
            }
        };
        this.i.importCompleted = delegateCombine(this.i.importCompleted, this._importCompleted_wrapped);
    }
}
//# sourceMappingURL=igc-triangulation-data-source.js.map
