/*
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 { Series } from "./Series";
import { DependencyProperty } from "igniteui-angular-core/ES2015/DependencyProperty";
import { IEnumerable_$type, Type, runOn, delegateCombine, delegateRemove, typeCast, markType } from "igniteui-angular-core/ES2015/type";
import { NumericXAxis } from "./NumericXAxis";
import { NumericYAxis } from "./NumericYAxis";
import { IFastItemsSource_$type } from "igniteui-angular-core/ES2015/IFastItemsSource";
import { Triangulator } from "igniteui-angular-core/ES2015/Triangulator";
import { TriangulationStatusEventArgs } from "igniteui-angular-core/ES2015/TriangulationStatusEventArgs";
import { FastItemsSource } from "igniteui-angular-core/ES2015/FastItemsSource";
import { SeriesViewer } from "./SeriesViewer";
import { Axis } from "./Axis";
import { AxisRange } from "./AxisRange";
import { PropertyMetadata } from "igniteui-angular-core/ES2015/PropertyMetadata";
/**
 * @hidden
 */
export class ScatterTriangulationSeries extends Series {
    constructor() {
        super(...arguments);
        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;
    }
    ht() {
        super.ht();
        this.lz = null;
        this.l0 = null;
    }
    fs(a, b) {
        let 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.fs(a, b);
    }
    get mc() {
        return this.l6;
    }
    set mc(a) {
        let b = this.mc != a;
        if (b) {
            let c = this.mc;
            this.l6 = a;
            this.raisePropertyChanged("XColumn", c, this.mc);
        }
    }
    get md() {
        return this.l7;
    }
    set md(a) {
        let b = this.md != a;
        if (b) {
            let c = this.md;
            this.l7 = a;
            this.raisePropertyChanged("YColumn", c, this.md);
        }
    }
    jd(a) {
        let 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;
        }
    }
    m5() {
        this.l2 = new Triangulator(this.bz.count, this.mc, this.md);
        let a = this.l2;
        a.triangulationStatusChanged = delegateCombine(a.triangulationStatusChanged, runOn(this, this.m6));
        this.l2.y();
    }
    m3() {
        if (this.l2 == null) {
            return;
        }
        this.l2.r();
        let a = this.l2;
        a.triangulationStatusChanged = delegateRemove(a.triangulationStatusChanged, runOn(this, this.m6));
        this.l2 = null;
    }
    m6(a, b) {
        if (this.triangulationStatusChanged != null) {
            this.triangulationStatusChanged(this, new TriangulationStatusEventArgs(b.currentStatus));
        }
        if (b.currentStatus >= 100) {
            if (this.l2 == null) {
                return;
            }
            let c = this.l2;
            c.triangulationStatusChanged = delegateRemove(c.triangulationStatusChanged, runOn(this, this.m6));
            this.mi = this.l2.n();
            this.l2 = null;
            let d = ((() => {
                let $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);
        }
    }
    l8(a, b) {
        if (b == null) {
            return a.registerColumnInt(null, null, false);
        }
        let c = null;
        let d = SeriesViewer.bb(b, this.coercionMethods);
        c = d.a;
        return a.registerColumnInt(b, c, this.expectFunctions);
    }
    iy(a, b, c, d) {
        super.iy(a, b, c, d);
        switch (b) {
            case "FastItemsSource":
                let e = typeCast(IFastItemsSource_$type, c);
                if (e != null) {
                    e.deregisterColumn(this.mc);
                    e.deregisterColumn(this.md);
                    this.mc = null;
                    this.md = null;
                }
                this.m4();
                let 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 = ((() => {
                        let $ret = new FastItemsSource();
                        $ret.e = this.trianglesSource;
                        return $ret;
                    })());
                }
                else {
                    this.me = null;
                }
                break;
            case ScatterTriangulationSeries.$$p[0]:
                let 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;
                }
                let 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;
        }
    }
    mh(a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    }
    mg(a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    }
    dw(a, b, c) {
        return super.dw(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;
    }
    m4() {
        if (this.trianglesSource == null) {
            this.mi = null;
            this.l9 = null;
            this.ma = null;
            this.mb = null;
            this.mf = false;
        }
    }
    ia() {
        super.ia();
        if (this.lz != null) {
            this.lz.g4();
        }
        if (this.l0 != null) {
            this.l0.g4();
        }
    }
    hy(a, b, c, d) {
        super.hy(a, b, c, d);
        this.m4();
        this.jc(false);
    }
    an(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;
    }
    js(a, b) {
        this.jc(false);
    }
    jr(a, b) {
        this.jc(false);
    }
    get l9() {
        return this.l3;
    }
    set l9(a) {
        let b = this.l9 != a;
        if (b) {
            let c = this.l9;
            this.l3 = a;
            this.raisePropertyChanged("TriangleVertexColumn1", c, this.l9);
        }
    }
    get ma() {
        return this.l4;
    }
    set ma(a) {
        let b = this.ma != a;
        if (b) {
            let c = this.ma;
            this.l4 = a;
            this.raisePropertyChanged("TriangleVertexColumn2", c, this.ma);
        }
    }
    get mb() {
        return this.l5;
    }
    set mb(a) {
        let b = this.mb != a;
        if (b) {
            let c = this.mb;
            this.l5 = a;
            this.raisePropertyChanged("TriangleVertexColumn3", c, this.mb);
        }
    }
    get_c5() {
        return true;
    }
}
ScatterTriangulationSeries.$t = markType(ScatterTriangulationSeries, 'ScatterTriangulationSeries', Series.$);
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