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.
*/
var IgxTriangulationDataSource = /** @class */ /*@__PURE__*/ (function () {
    function IgxTriangulationDataSource() {
        this._zoneRunner = null;
        this._importCompleted = null;
        this._implementation = this.createImplementation();
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    }
    IgxTriangulationDataSource.prototype.createImplementation = function () {
        return new ItfConverter_internal();
    };
    Object.defineProperty(IgxTriangulationDataSource.prototype, "i", {
        get: function () {
            return this._implementation;
        },
        enumerable: false,
        configurable: true
    });
    IgxTriangulationDataSource.prototype.onImplementationCreated = function () {
    };
    IgxTriangulationDataSource.prototype._provideImplementation = function (i) {
        this._implementation = i;
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    };
    Object.defineProperty(IgxTriangulationDataSource.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: false,
        configurable: true
    });
    /**
    * Gets the point data.
    */
    IgxTriangulationDataSource.prototype.getPointData = function () {
        var iv = this.i.getPointData();
        return iv._inner;
    };
    /**
    * Gets the triangle data.
    */
    IgxTriangulationDataSource.prototype.getTriangleData = function () {
        var iv = this.i.getTriangleData();
        return iv._inner;
    };
    IgxTriangulationDataSource.prototype.findByName = function (name) {
        return null;
    };
    IgxTriangulationDataSource.prototype._runInZone = function (act) {
        if (this._zoneRunner != null) {
            this._zoneRunner(act);
        }
        else {
            act();
        }
    };
    Object.defineProperty(IgxTriangulationDataSource.prototype, "importCompleted", {
        /**
         * Event raised when the import operation has completed
        */
        get: function () {
            var _this = this;
            if (this._importCompleted == null) {
                this._importCompleted = new EventEmitter();
                this.i.importCompleted = delegateCombine(this.i.importCompleted, function (o, e) {
                    _this._runInZone(function () {
                        var outerArgs = new IgxAsyncCompletedEventArgs();
                        outerArgs._provideImplementation(e);
                        if (_this.beforeImportCompleted) {
                            _this.beforeImportCompleted(_this, outerArgs);
                        }
                        _this._importCompleted.emit({
                            sender: _this,
                            args: outerArgs
                        });
                    });
                });
            }
            return this._importCompleted;
        },
        enumerable: false,
        configurable: true
    });
    return IgxTriangulationDataSource;
}());
export { IgxTriangulationDataSource };
