/*
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.l6 = null;
        _this.l7 = null;
        _this.mf = false;
        _this.l2 = null;
        _this.triangulationStatusChanged = null;
        _this.mi = null;
        _this.l3 = null;
        _this.l4 = null;
        _this.l5 = null;
        return _this;
    }
    ScatterTriangulationSeries.prototype.ht = function () {
        _super.prototype.ht.call(this);
        this.lz = null;
        this.l0 = null;
    };
    ScatterTriangulationSeries.prototype.fs = function (a, b) {
        var c = this.gu(b);
        if (c == ScatterTriangulationSeries.$$p[6]) {
            return this.ft(a, b, this.mx);
        }
        if (c == ScatterTriangulationSeries.$$p[8]) {
            return this.ft(a, b, this.m1);
        }
        return _super.prototype.fs.call(this, a, b);
    };
    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("XColumn", c, this.mc);
            }
        },
        enumerable: true,
        configurable: true
    });
    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("YColumn", c, this.md);
            }
        },
        enumerable: true,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.jd = function (a) {
        var b = this.bz != null && this.me == null && this.mi == null && this.mc != null && this.md != null && this.mc.count >= 3 && this.md.count >= 3 && !this.mf;
        if (b) {
            this.m5();
            this.mf = true;
        }
    };
    ScatterTriangulationSeries.prototype.m5 = function () {
        this.l2 = new Triangulator(this.bz.count, this.mc, this.md);
        var a = this.l2;
        a.triangulationStatusChanged = delegateCombine(a.triangulationStatusChanged, runOn(this, this.m6));
        this.l2.y();
    };
    ScatterTriangulationSeries.prototype.m3 = function () {
        if (this.l2 == null) {
            return;
        }
        this.l2.r();
        var a = this.l2;
        a.triangulationStatusChanged = delegateRemove(a.triangulationStatusChanged, runOn(this, this.m6));
        this.l2 = null;
    };
    ScatterTriangulationSeries.prototype.m6 = function (a, b) {
        var _this = this;
        if (this.triangulationStatusChanged != null) {
            this.triangulationStatusChanged(this, new TriangulationStatusEventArgs(b.currentStatus));
        }
        if (b.currentStatus >= 100) {
            if (this.l2 == null) {
                return;
            }
            var c = this.l2;
            c.triangulationStatusChanged = delegateRemove(c.triangulationStatusChanged, runOn(this, this.m6));
            this.mi = this.l2.n();
            this.l2 = null;
            var d = ((function () {
                var $ret = new FastItemsSource();
                $ret.e = _this.mi;
                return $ret;
            })());
            this.l9 = this.l8(d, "v1");
            this.ma = this.l8(d, "v2");
            this.mb = this.l8(d, "v3");
            this.jc(false);
        }
    };
    ScatterTriangulationSeries.prototype.l8 = 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.iy = function (a, b, c, d) {
        var _this = this;
        _super.prototype.iy.call(this, a, b, c, d);
        switch (b) {
            case "FastItemsSource":
                var e = typeCast(IFastItemsSource_$type, c);
                if (e != null) {
                    e.deregisterColumn(this.mc);
                    e.deregisterColumn(this.md);
                    this.mc = null;
                    this.md = null;
                }
                this.m4();
                var f = typeCast(IFastItemsSource_$type, d);
                if (f != null) {
                    this.mc = this.bw(this.mx);
                    this.md = this.bw(this.m1);
                }
                this.jc(false);
                break;
            case ScatterTriangulationSeries.$$p[6]:
                if (this.bz != null) {
                    this.bz.deregisterColumn(this.mc);
                    this.mc = this.bw(this.mx);
                }
                this.m4();
                this.jc(false);
                this.ij();
                break;
            case ScatterTriangulationSeries.$$p[8]:
                if (this.bz != null) {
                    this.bz.deregisterColumn(this.md);
                    this.md = this.bw(this.m1);
                }
                this.m4();
                this.jc(false);
                this.ij();
                break;
            case ScatterTriangulationSeries.$$p[5]:
                if (c != null) {
                    (typeCast(Axis.$, c)).bv(this);
                }
                if (d != null) {
                    (typeCast(Axis.$, d)).ch(this);
                }
                if ((this.lz != null && !this.lz.ck()) || (d == null && c != null)) {
                    this.jc(false);
                }
                this.ij();
                break;
            case ScatterTriangulationSeries.$$p[7]:
                if (c != null) {
                    (typeCast(Axis.$, c)).bv(this);
                }
                if (d != null) {
                    (typeCast(Axis.$, d)).ch(this);
                }
                if ((this.l0 != null && !this.l0.ck()) || (d == null && c != null)) {
                    this.jc(false);
                }
                this.ij();
                break;
            case ScatterTriangulationSeries.$$p[1]:
                if (this.trianglesSource != null) {
                    this.m3();
                    this.me = ((function () {
                        var $ret = new FastItemsSource();
                        $ret.e = _this.trianglesSource;
                        return $ret;
                    })());
                }
                else {
                    this.me = null;
                }
                break;
            case ScatterTriangulationSeries.$$p[0]:
                var g = typeCast(IFastItemsSource_$type, c);
                if (g != null) {
                    g.deregisterColumn(this.l9);
                    g.deregisterColumn(this.ma);
                    g.deregisterColumn(this.mb);
                    this.l9 = null;
                    this.ma = null;
                    this.mb = null;
                }
                var h = typeCast(IFastItemsSource_$type, d);
                if (h != null) {
                    this.l9 = this.l8(h, this.mp);
                    this.ma = this.l8(h, this.mr);
                    this.mb = this.l8(h, this.mt);
                }
                this.jc(false);
                this.ij();
                break;
            case ScatterTriangulationSeries.$$p[2]:
                if (this.me != null) {
                    this.me.deregisterColumn(this.l9);
                    this.l9 = this.l8(this.me, this.mp);
                }
                this.jc(false);
                this.ij();
                break;
            case ScatterTriangulationSeries.$$p[3]:
                if (this.me != null) {
                    this.me.deregisterColumn(this.ma);
                    this.ma = this.l8(this.me, this.mr);
                }
                this.jc(false);
                this.ij();
                break;
            case ScatterTriangulationSeries.$$p[4]:
                if (this.me != null) {
                    this.me.deregisterColumn(this.mb);
                    this.mb = this.l8(this.me, this.mt);
                }
                this.jc(false);
                this.ij();
                break;
            case "XColumn":
                if (this.lz != null) {
                    this.lz.ck();
                }
                break;
            case "YColumn":
                if (this.l0 != null) {
                    this.l0.ck();
                }
                break;
        }
    };
    ScatterTriangulationSeries.prototype.mh = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.mg = 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.lz != null && this.l0 != null && this.lz.bf != null && this.l0.bf != null && a.width > 0 && a.height > 0 && this.l9 != null && this.l9.count > 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;
    };
    ScatterTriangulationSeries.prototype.m4 = function () {
        if (this.trianglesSource == null) {
            this.mi = null;
            this.l9 = null;
            this.ma = null;
            this.mb = null;
            this.mf = false;
        }
    };
    ScatterTriangulationSeries.prototype.ia = function () {
        _super.prototype.ia.call(this);
        if (this.lz != null) {
            this.lz.g4();
        }
        if (this.l0 != null) {
            this.l0.g4();
        }
    };
    ScatterTriangulationSeries.prototype.hy = function (a, b, c, d) {
        _super.prototype.hy.call(this, a, b, c, d);
        this.m4();
        this.jc(false);
    };
    ScatterTriangulationSeries.prototype.an = function (a) {
        if (a != null && a == this.lz && this.mc != null) {
            return new AxisRange(this.mc.minimum, this.mc.maximum);
        }
        if (a != null && a == this.l0 && this.md != null) {
            return new AxisRange(this.md.minimum, this.md.maximum);
        }
        return null;
    };
    ScatterTriangulationSeries.prototype.js = function (a, b) {
        this.jc(false);
    };
    ScatterTriangulationSeries.prototype.jr = function (a, b) {
        this.jc(false);
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "l9", {
        get: function () {
            return this.l3;
        },
        set: function (a) {
            var b = this.l9 != a;
            if (b) {
                var c = this.l9;
                this.l3 = a;
                this.raisePropertyChanged("TriangleVertexColumn1", c, this.l9);
            }
        },
        enumerable: true,
        configurable: true
    });
    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("TriangleVertexColumn2", 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("TriangleVertexColumn3", c, this.mb);
            }
        },
        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:me:m7', [IFastItemsSource_$type, null], 'TrianglesSource::m8', [IEnumerable_$type, null], 'TriangleVertexMemberPath1:mp:m9', [2, null], 'TriangleVertexMemberPath2:mr:na', [2, null], 'TriangleVertexMemberPath3:mt:nb', [2, null], 'XAxis:lz:nc', [NumericXAxis.$, null], 'XMemberPath:mx:nd', [2, null], 'YAxis:l0:ne', [NumericYAxis.$, null], 'YMemberPath:m1:nf', [2, null]]);
//# sourceMappingURL=ScatterTriangulationSeries.js.map