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.
*/
var IgcTriangulationDataSource = /** @class */ /*@__PURE__*/ (function () {
    function IgcTriangulationDataSource() {
        //@@ZoneRunner
        this._importCompleted = null;
        this._importCompleted_wrapped = null;
        this._implementation = this.createImplementation();
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    }
    IgcTriangulationDataSource.prototype.createImplementation = function () {
        return new ItfConverter_internal();
    };
    Object.defineProperty(IgcTriangulationDataSource.prototype, "i", {
        get: function () {
            return this._implementation;
        },
        enumerable: true,
        configurable: true
    });
    IgcTriangulationDataSource.prototype.onImplementationCreated = function () {
    };
    IgcTriangulationDataSource.prototype._provideImplementation = function (i) {
        this._implementation = i;
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    };
    Object.defineProperty(IgcTriangulationDataSource.prototype, "source", {
        /**
         * Gets the string path specifying the location of the Itf file.
        */
        get: function () {
            if (this.i.source == null)
                return null;
            return this.i.source.value;
        },
        /**
         * Sets the string path specifying the location of the Itf file.
        */
        set: function (v) {
            if (v == null) {
                this.i.source = null;
            }
            else {
                this.i.source = new Uri(0, v);
            }
        },
        enumerable: true,
        configurable: true
    });
    /**
    * Gets the point data.
    */
    IgcTriangulationDataSource.prototype.getPointData = function () {
        var iv = this.i.getPointData();
        return iv._inner;
    };
    /**
    * Gets the triangle data.
    */
    IgcTriangulationDataSource.prototype.getTriangleData = function () {
        var iv = this.i.getTriangleData();
        return iv._inner;
    };
    IgcTriangulationDataSource.prototype.findByName = function (name) {
        return null;
    };
    Object.defineProperty(IgcTriangulationDataSource.prototype, "importCompleted", {
        /**
         * Event raised when the import operation has completed
        */
        get: function () {
            return this._importCompleted;
        },
        set: function (ev) {
            var _this = this;
            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 = function (o, e) {
                var 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);
        },
        enumerable: true,
        configurable: true
    });
    return IgcTriangulationDataSource;
}());
export { IgcTriangulationDataSource };
