/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import * as tslib_1 from "tslib";
import { Series } from "./Series";
import { DependencyProperty } from "igniteui-angular-core/ES5/DependencyProperty";
import { IEnumerable_$type, Type, runOn, delegateCombine, delegateRemove, typeCast, markType } from "igniteui-angular-core/ES5/type";
import { NumericXAxis } from "./NumericXAxis";
import { NumericYAxis } from "./NumericYAxis";
import { IFastItemsSource_$type } from "igniteui-angular-core/ES5/IFastItemsSource";
import { Triangulator } from "igniteui-angular-core/ES5/Triangulator";
import { TriangulationStatusEventArgs } from "igniteui-angular-core/ES5/TriangulationStatusEventArgs";
import { FastItemsSource } from "igniteui-angular-core/ES5/FastItemsSource";
import { SeriesViewer } from "./SeriesViewer";
import { Axis } from "./Axis";
import { AxisRange } from "./AxisRange";
import { PropertyMetadata } from "igniteui-angular-core/ES5/PropertyMetadata";
/**
 * @hidden
 */
var ScatterTriangulationSeries = /** @class */ (function (_super) {
    tslib_1.__extends(ScatterTriangulationSeries, _super);
    function ScatterTriangulationSeries() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.lz = null;
        _this.l0 = null;
        _this.l8 = false;
        _this.lv = null;
        _this.triangulationStatusChanged = null;
        _this.mb = null;
        _this.lw = null;
        _this.lx = null;
        _this.ly = null;
        return _this;
    }
    ScatterTriangulationSeries.prototype.hn = function () {
        _super.prototype.hn.call(this);
        this.ls = null;
        this.lt = null;
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "l5", {
        get: function () {
            return this.lz;
        },
        set: function (a) {
            var b = this.l5 != a;
            if (b) {
                var c = this.l5;
                this.lz = a;
                this.raisePropertyChanged("XColumn", c, this.l5);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "l6", {
        get: function () {
            return this.l0;
        },
        set: function (a) {
            var b = this.l6 != a;
            if (b) {
                var c = this.l6;
                this.l0 = a;
                this.raisePropertyChanged("YColumn", c, this.l6);
            }
        },
        enumerable: true,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.i6 = function (a) {
        var b = this.bz != null && this.l7 == null && this.mb == null && this.l5 != null && this.l6 != null && this.l5.count >= 3 && this.l6.count >= 3 && !this.l8;
        if (b) {
            this.my();
            this.l8 = true;
        }
    };
    ScatterTriangulationSeries.prototype.my = function () {
        this.lv = new Triangulator(this.bz.count, this.l5, this.l6);
        var a = this.lv;
        a.triangulationStatusChanged = delegateCombine(a.triangulationStatusChanged, runOn(this, this.mz));
        this.lv.y();
    };
    ScatterTriangulationSeries.prototype.mw = function () {
        if (this.lv == null) {
            return;
        }
        this.lv.r();
        var a = this.lv;
        a.triangulationStatusChanged = delegateRemove(a.triangulationStatusChanged, runOn(this, this.mz));
        this.lv = null;
    };
    ScatterTriangulationSeries.prototype.mz = function (a, b) {
        var _this = this;
        if (this.triangulationStatusChanged != null) {
            this.triangulationStatusChanged(this, new TriangulationStatusEventArgs(b.currentStatus));
        }
        if (b.currentStatus >= 100) {
            if (this.lv == null) {
                return;
            }
            var c = this.lv;
            c.triangulationStatusChanged = delegateRemove(c.triangulationStatusChanged, runOn(this, this.mz));
            this.mb = this.lv.n();
            this.lv = null;
            var d = ((function () {
                var $ret = new FastItemsSource();
                $ret.e = _this.mb;
                return $ret;
            })());
            this.l2 = this.l1(d, "v1");
            this.l3 = this.l1(d, "v2");
            this.l4 = this.l1(d, "v3");
            this.i5(false);
        }
    };
    ScatterTriangulationSeries.prototype.l1 = function (a, b) {
        if (b == null) {
            return a.registerColumnInt(null, null, false);
        }
        var c = null;
        var d = SeriesViewer.bb(b, this.coercionMethods);
        c = d.a;
        return a.registerColumnInt(b, c, this.expectFunctions);
    };
    ScatterTriangulationSeries.prototype.is = function (a, b, c, d) {
        var _this = this;
        _super.prototype.is.call(this, a, b, c, d);
        switch (b) {
            case "FastItemsSource":
                var e = typeCast(IFastItemsSource_$type, c);
                if (e != null) {
                    e.deregisterColumn(this.l5);
                    e.deregisterColumn(this.l6);
                    this.l5 = null;
                    this.l6 = null;
                }
                this.mx();
                var f = typeCast(IFastItemsSource_$type, d);
                if (f != null) {
                    this.l5 = this.bw(this.mq);
                    this.l6 = this.bw(this.mu);
                }
                this.i5(false);
                break;
            case ScatterTriangulationSeries.$$p[6]:
                if (this.bz != null) {
                    this.bz.deregisterColumn(this.l5);
                    this.l5 = this.bw(this.mq);
                }
                this.mx();
                this.i5(false);
                this.ic();
                break;
            case ScatterTriangulationSeries.$$p[8]:
                if (this.bz != null) {
                    this.bz.deregisterColumn(this.l6);
                    this.l6 = this.bw(this.mu);
                }
                this.mx();
                this.i5(false);
                this.ic();
                break;
            case ScatterTriangulationSeries.$$p[5]:
                if (c != null) {
                    (typeCast(Axis.$, c)).bv(this);
                }
                if (d != null) {
                    (typeCast(Axis.$, d)).ch(this);
                }
                if ((this.ls != null && !this.ls.ck()) || (d == null && c != null)) {
                    this.i5(false);
                }
                this.ic();
                break;
            case ScatterTriangulationSeries.$$p[7]:
                if (c != null) {
                    (typeCast(Axis.$, c)).bv(this);
                }
                if (d != null) {
                    (typeCast(Axis.$, d)).ch(this);
                }
                if ((this.lt != null && !this.lt.ck()) || (d == null && c != null)) {
                    this.i5(false);
                }
                this.ic();
                break;
            case ScatterTriangulationSeries.$$p[1]:
                if (this.trianglesSource != null) {
                    this.mw();
                    this.l7 = ((function () {
                        var $ret = new FastItemsSource();
                        $ret.e = _this.trianglesSource;
                        return $ret;
                    })());
                }
                else {
                    this.l7 = null;
                }
                break;
            case ScatterTriangulationSeries.$$p[0]:
                var g = typeCast(IFastItemsSource_$type, c);
                if (g != null) {
                    g.deregisterColumn(this.l2);
                    g.deregisterColumn(this.l3);
                    g.deregisterColumn(this.l4);
                    this.l2 = null;
                    this.l3 = null;
                    this.l4 = null;
                }
                var h = typeCast(IFastItemsSource_$type, d);
                if (h != null) {
                    this.l2 = this.l1(h, this.mi);
                    this.l3 = this.l1(h, this.mk);
                    this.l4 = this.l1(h, this.mm);
                }
                this.i5(false);
                this.ic();
                break;
            case ScatterTriangulationSeries.$$p[2]:
                if (this.l7 != null) {
                    this.l7.deregisterColumn(this.l2);
                    this.l2 = this.l1(this.l7, this.mi);
                }
                this.i5(false);
                this.ic();
                break;
            case ScatterTriangulationSeries.$$p[3]:
                if (this.l7 != null) {
                    this.l7.deregisterColumn(this.l3);
                    this.l3 = this.l1(this.l7, this.mk);
                }
                this.i5(false);
                this.ic();
                break;
            case ScatterTriangulationSeries.$$p[4]:
                if (this.l7 != null) {
                    this.l7.deregisterColumn(this.l4);
                    this.l4 = this.l1(this.l7, this.mm);
                }
                this.i5(false);
                this.ic();
                break;
            case "XColumn":
                if (this.ls != null) {
                    this.ls.ck();
                }
                break;
            case "YColumn":
                if (this.lt != null) {
                    this.lt.ck();
                }
                break;
        }
    };
    ScatterTriangulationSeries.prototype.ma = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.l9 = function (a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.dv = function (a, b, c) {
        return _super.prototype.dv.call(this, a, b, c) && this.bz != null && this.ls != null && this.lt != null && this.ls.bf != null && this.lt.bf != null && a.width > 0 && a.height > 0 && this.l2 != null && this.l2.count > 0 && this.l3 != null && this.l3.count > 0 && this.l4 != null && this.l4.count > 0 && this.l5 != null && this.l5.count > 0 && this.l6 != null && this.l6.count > 0;
    };
    ScatterTriangulationSeries.prototype.mx = function () {
        if (this.trianglesSource == null) {
            this.mb = null;
            this.l2 = null;
            this.l3 = null;
            this.l4 = null;
            this.l8 = false;
        }
    };
    ScatterTriangulationSeries.prototype.h4 = function () {
        _super.prototype.h4.call(this);
        if (this.ls != null) {
            this.ls.gz();
        }
        if (this.lt != null) {
            this.lt.gz();
        }
    };
    ScatterTriangulationSeries.prototype.hs = function (a, b, c, d) {
        _super.prototype.hs.call(this, a, b, c, d);
        this.mx();
        this.i5(false);
    };
    ScatterTriangulationSeries.prototype.an = function (a) {
        if (a != null && a == this.ls && this.l5 != null) {
            return new AxisRange(this.l5.minimum, this.l5.maximum);
        }
        if (a != null && a == this.lt && this.l6 != null) {
            return new AxisRange(this.l6.minimum, this.l6.maximum);
        }
        return null;
    };
    ScatterTriangulationSeries.prototype.jl = function (a, b) {
        this.i5(false);
    };
    ScatterTriangulationSeries.prototype.jk = function (a, b) {
        this.i5(false);
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "l2", {
        get: function () {
            return this.lw;
        },
        set: function (a) {
            var b = this.l2 != a;
            if (b) {
                var c = this.l2;
                this.lw = a;
                this.raisePropertyChanged("TriangleVertexColumn1", c, this.l2);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "l3", {
        get: function () {
            return this.lx;
        },
        set: function (a) {
            var b = this.l3 != a;
            if (b) {
                var c = this.l3;
                this.lx = a;
                this.raisePropertyChanged("TriangleVertexColumn2", c, this.l3);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "l4", {
        get: function () {
            return this.ly;
        },
        set: function (a) {
            var b = this.l4 != a;
            if (b) {
                var c = this.l4;
                this.ly = a;
                this.raisePropertyChanged("TriangleVertexColumn3", c, this.l4);
            }
        },
        enumerable: true,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.get_c5 = function () {
        return true;
    };
    ScatterTriangulationSeries.$t = markType(ScatterTriangulationSeries, 'ScatterTriangulationSeries', Series.$);
    return ScatterTriangulationSeries;
}(Series));
export { ScatterTriangulationSeries };
Type.dep(DependencyProperty, PropertyMetadata, ScatterTriangulationSeries, 'raisePropertyChanged', ['FastTrianglesSource:l7:m0', [IFastItemsSource_$type, null], 'TrianglesSource::m1', [IEnumerable_$type, null], 'TriangleVertexMemberPath1:mi:m2', [2, null], 'TriangleVertexMemberPath2:mk:m3', [2, null], 'TriangleVertexMemberPath3:mm:m4', [2, null], 'XAxis:ls:m5', [NumericXAxis.$, null], 'XMemberPath:mq:m6', [2, null], 'YAxis:lt:m7', [NumericYAxis.$, null], 'YMemberPath:mu:m8', [2, null]]);
//# sourceMappingURL=ScatterTriangulationSeries.js.map