/*
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";
import { IEnumerable_$type, runOn, delegateCombine, delegateRemove, typeCast, markType, markDep } from "igniteui-angular-core";
import { NumericXAxis } from "./NumericXAxis";
import { NumericYAxis } from "./NumericYAxis";
import { IFastItemsSource_$type } from "igniteui-angular-core";
import { Triangulator } from "igniteui-angular-core";
import { TriangulationStatusEventArgs } from "igniteui-angular-core";
import { FastItemsSource } from "igniteui-angular-core";
import { SeriesViewer } from "./SeriesViewer";
import { Axis } from "./Axis";
import { AxisRange } from "./AxisRange";
import { PropertyMetadata } from "igniteui-angular-core";
/**
 * @hidden
 */
var ScatterTriangulationSeries = /** @class */ (function (_super) {
    tslib_1.__extends(ScatterTriangulationSeries, _super);
    function ScatterTriangulationSeries() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.l7 = null;
        _this.l8 = null;
        _this.mg = false;
        _this.l3 = null;
        _this.triangulationStatusChanged = null;
        _this.mj = null;
        _this.l4 = null;
        _this.l5 = null;
        _this.l6 = null;
        return _this;
    }
    ScatterTriangulationSeries.prototype.ht = function () {
        _super.prototype.ht.call(this);
        this.l0 = null;
        this.l1 = null;
    };
    ScatterTriangulationSeries.prototype.fs = function (a, b) {
        var c = this.gu(b);
        if (c == ScatterTriangulationSeries.$$p[6]) {
            return this.ft(a, b, this.my);
        }
        if (c == ScatterTriangulationSeries.$$p[8]) {
            return this.ft(a, b, this.m2);
        }
        return _super.prototype.fs.call(this, a, b);
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "md", {
        get: function () {
            return this.l7;
        },
        set: function (a) {
            var b = this.md != a;
            if (b) {
                var c = this.md;
                this.l7 = a;
                this.raisePropertyChanged("XColumn", c, this.md);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "me", {
        get: function () {
            return this.l8;
        },
        set: function (a) {
            var b = this.me != a;
            if (b) {
                var c = this.me;
                this.l8 = a;
                this.raisePropertyChanged("YColumn", c, this.me);
            }
        },
        enumerable: true,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.je = function (a) {
        var b = this.bz != null && this.mf == null && this.mj == null && this.md != null && this.me != null && this.md.count >= 3 && this.me.count >= 3 && !this.mg;
        if (b) {
            this.m6();
            this.mg = true;
        }
    };
    ScatterTriangulationSeries.prototype.m6 = function () {
        this.l3 = new Triangulator(this.bz.count, this.md, this.me);
        var a = this.l3;
        a.triangulationStatusChanged = delegateCombine(a.triangulationStatusChanged, runOn(this, this.m7));
        this.l3.y();
    };
    ScatterTriangulationSeries.prototype.m4 = function () {
        if (this.l3 == null) {
            return;
        }
        this.l3.r();
        var a = this.l3;
        a.triangulationStatusChanged = delegateRemove(a.triangulationStatusChanged, runOn(this, this.m7));
        this.l3 = null;
    };
    ScatterTriangulationSeries.prototype.m7 = function (a, b) {
        var _this = this;
        if (this.triangulationStatusChanged != null) {
            this.triangulationStatusChanged(this, new TriangulationStatusEventArgs(b.currentStatus));
        }
        if (b.currentStatus >= 100) {
            if (this.l3 == null) {
                return;
            }
            var c = this.l3;
            c.triangulationStatusChanged = delegateRemove(c.triangulationStatusChanged, runOn(this, this.m7));
            this.mj = this.l3.n();
            this.l3 = null;
            var d = ((function () {
                var $ret = new FastItemsSource();
                $ret.e = _this.mj;
                return $ret;
            })());
            this.ma = this.l9(d, "v1");
            this.mb = this.l9(d, "v2");
            this.mc = this.l9(d, "v3");
            this.jd(false);
        }
    };
    ScatterTriangulationSeries.prototype.l9 = 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.iz = function (a, b, c, d) {
        var _this = this;
        _super.prototype.iz.call(this, a, b, c, d);
        switch (b) {
            case "FastItemsSource":
                var e = typeCast(IFastItemsSource_$type, c);
                if (e != null) {
                    e.deregisterColumn(this.md);
                    e.deregisterColumn(this.me);
                    this.md = null;
                    this.me = null;
                }
                this.m5();
                var f = typeCast(IFastItemsSource_$type, d);
                if (f != null) {
                    this.md = this.bw(this.my);
                    this.me = this.bw(this.m2);
                }
                this.jd(false);
                break;
            case ScatterTriangulationSeries.$$p[6]:
                if (this.bz != null) {
                    this.bz.deregisterColumn(this.md);
                    this.md = this.bw(this.my);
                }
                this.m5();
                this.jd(false);
                this.ik();
                break;
            case ScatterTriangulationSeries.$$p[8]:
                if (this.bz != null) {
                    this.bz.deregisterColumn(this.me);
                    this.me = this.bw(this.m2);
                }
                this.m5();
                this.jd(false);
                this.ik();
                break;
            case ScatterTriangulationSeries.$$p[5]:
                if (c != null) {
                    (typeCast(Axis.$, c)).bv(this);
                }
                if (d != null) {
                    (typeCast(Axis.$, d)).ci(this);
                }
                if ((this.l0 != null && !this.l0.cl()) || (d == null && c != null)) {
                    this.jd(false);
                }
                this.ik();
                break;
            case ScatterTriangulationSeries.$$p[7]:
                if (c != null) {
                    (typeCast(Axis.$, c)).bv(this);
                }
                if (d != null) {
                    (typeCast(Axis.$, d)).ci(this);
                }
                if ((this.l1 != null && !this.l1.cl()) || (d == null && c != null)) {
                    this.jd(false);
                }
                this.ik();
                break;
            case ScatterTriangulationSeries.$$p[1]:
                if (this.trianglesSource != null) {
                    this.m4();
                    this.mf = ((function () {
                        var $ret = new FastItemsSource();
                        $ret.e = _this.trianglesSource;
                        return $ret;
                    })());
                }
                else {
                    this.mf = null;
                }
                break;
            case ScatterTriangulationSeries.$$p[0]:
                var g = typeCast(IFastItemsSource_$type, c);
                if (g != null) {
                    g.deregisterColumn(this.ma);
                    g.deregisterColumn(this.mb);
                    g.deregisterColumn(this.mc);
                    this.ma = null;
                    this.mb = null;
                    this.mc = null;
                }
                var h = typeCast(IFastItemsSource_$type, d);
                if (h != null) {
                    this.ma = this.l9(h, this.mq);
                    this.mb = this.l9(h, this.ms);
                    this.mc = this.l9(h, this.mu);
                }
                this.jd(false);
                this.ik();
                break;
            case ScatterTriangulationSeries.$$p[2]:
                if (this.mf != null) {
                    this.mf.deregisterColumn(this.ma);
                    this.ma = this.l9(this.mf, this.mq);
                }
                this.jd(false);
                this.ik();
                break;
            case ScatterTriangulationSeries.$$p[3]:
                if (this.mf != null) {
                    this.mf.deregisterColumn(this.mb);
                    this.mb = this.l9(this.mf, this.ms);
                }
                this.jd(false);
                this.ik();
                break;
            case ScatterTriangulationSeries.$$p[4]:
                if (this.mf != null) {
                    this.mf.deregisterColumn(this.mc);
                    this.mc = this.l9(this.mf, this.mu);
                }
                this.jd(false);
                this.ik();
                break;
            case "XColumn":
                if (this.l0 != null) {
                    this.l0.cl();
                }
                break;
            case "YColumn":
                if (this.l1 != null) {
                    this.l1.cl();
                }
                break;
        }
    };
    ScatterTriangulationSeries.prototype.mi = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.mh = function (a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.dw = function (a, b, c) {
        return _super.prototype.dw.call(this, a, b, c) && this.bz != null && this.l0 != null && this.l1 != null && this.l0.bf != null && this.l1.bf != null && a.width > 0 && a.height > 0 && this.ma != null && this.ma.count > 0 && this.mb != null && this.mb.count > 0 && this.mc != null && this.mc.count > 0 && this.md != null && this.md.count > 0 && this.me != null && this.me.count > 0;
    };
    ScatterTriangulationSeries.prototype.m5 = function () {
        if (this.trianglesSource == null) {
            this.mj = null;
            this.ma = null;
            this.mb = null;
            this.mc = null;
            this.mg = false;
        }
    };
    ScatterTriangulationSeries.prototype.ib = function () {
        _super.prototype.ib.call(this);
        if (this.l0 != null) {
            this.l0.g5();
        }
        if (this.l1 != null) {
            this.l1.g5();
        }
    };
    ScatterTriangulationSeries.prototype.hy = function (a, b, c, d) {
        _super.prototype.hy.call(this, a, b, c, d);
        this.m5();
        this.jd(false);
    };
    ScatterTriangulationSeries.prototype.an = function (a) {
        if (a != null && a == this.l0 && this.md != null) {
            return new AxisRange(this.md.minimum, this.md.maximum);
        }
        if (a != null && a == this.l1 && this.me != null) {
            return new AxisRange(this.me.minimum, this.me.maximum);
        }
        return null;
    };
    ScatterTriangulationSeries.prototype.jt = function (a, b) {
        this.jd(false);
    };
    ScatterTriangulationSeries.prototype.js = function (a, b) {
        this.jd(false);
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "ma", {
        get: function () {
            return this.l4;
        },
        set: function (a) {
            var b = this.ma != a;
            if (b) {
                var c = this.ma;
                this.l4 = a;
                this.raisePropertyChanged("TriangleVertexColumn1", c, this.ma);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "mb", {
        get: function () {
            return this.l5;
        },
        set: function (a) {
            var b = this.mb != a;
            if (b) {
                var c = this.mb;
                this.l5 = a;
                this.raisePropertyChanged("TriangleVertexColumn2", c, this.mb);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "mc", {
        get: function () {
            return this.l6;
        },
        set: function (a) {
            var b = this.mc != a;
            if (b) {
                var c = this.mc;
                this.l6 = a;
                this.raisePropertyChanged("TriangleVertexColumn3", c, this.mc);
            }
        },
        enumerable: true,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.get_c5 = function () {
        return true;
    };
    ScatterTriangulationSeries.$t = markType(ScatterTriangulationSeries, 'ScatterTriangulationSeries', Series.$);
    ScatterTriangulationSeries.$$p = markDep(DependencyProperty, PropertyMetadata, ScatterTriangulationSeries, 'raisePropertyChanged', ['FastTrianglesSource:mf:m8', [IFastItemsSource_$type, null], 'TrianglesSource::m9', [IEnumerable_$type, null], 'TriangleVertexMemberPath1:mq:na', [2, null], 'TriangleVertexMemberPath2:ms:nb', [2, null], 'TriangleVertexMemberPath3:mu:nc', [2, null], 'XAxis:l0:nd', [NumericXAxis.$, null], 'XMemberPath:my:ne', [2, null], 'YAxis:l1:nf', [NumericYAxis.$, null], 'YMemberPath:m2:ng', [2, null]]);
    return ScatterTriangulationSeries;
}(Series));
export { ScatterTriangulationSeries };
//# sourceMappingURL=ScatterTriangulationSeries.js.map