/*
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";
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
 */
export class ScatterTriangulationSeries extends Series {
    constructor() {
        super(...arguments);
        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;
    }
    ht() {
        super.ht();
        this.l0 = null;
        this.l1 = null;
    }
    fs(a, b) {
        let 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.fs(a, b);
    }
    get md() {
        return this.l7;
    }
    set md(a) {
        let b = this.md != a;
        if (b) {
            let c = this.md;
            this.l7 = a;
            this.raisePropertyChanged("XColumn", c, this.md);
        }
    }
    get me() {
        return this.l8;
    }
    set me(a) {
        let b = this.me != a;
        if (b) {
            let c = this.me;
            this.l8 = a;
            this.raisePropertyChanged("YColumn", c, this.me);
        }
    }
    je(a) {
        let 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;
        }
    }
    m6() {
        this.l3 = new Triangulator(this.bz.count, this.md, this.me);
        let a = this.l3;
        a.triangulationStatusChanged = delegateCombine(a.triangulationStatusChanged, runOn(this, this.m7));
        this.l3.y();
    }
    m4() {
        if (this.l3 == null) {
            return;
        }
        this.l3.r();
        let a = this.l3;
        a.triangulationStatusChanged = delegateRemove(a.triangulationStatusChanged, runOn(this, this.m7));
        this.l3 = null;
    }
    m7(a, b) {
        if (this.triangulationStatusChanged != null) {
            this.triangulationStatusChanged(this, new TriangulationStatusEventArgs(b.currentStatus));
        }
        if (b.currentStatus >= 100) {
            if (this.l3 == null) {
                return;
            }
            let c = this.l3;
            c.triangulationStatusChanged = delegateRemove(c.triangulationStatusChanged, runOn(this, this.m7));
            this.mj = this.l3.n();
            this.l3 = null;
            let d = ((() => {
                let $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);
        }
    }
    l9(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);
    }
    iz(a, b, c, d) {
        super.iz(a, b, c, d);
        switch (b) {
            case "FastItemsSource":
                let e = typeCast(IFastItemsSource_$type, c);
                if (e != null) {
                    e.deregisterColumn(this.md);
                    e.deregisterColumn(this.me);
                    this.md = null;
                    this.me = null;
                }
                this.m5();
                let 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 = ((() => {
                        let $ret = new FastItemsSource();
                        $ret.e = this.trianglesSource;
                        return $ret;
                    })());
                }
                else {
                    this.mf = null;
                }
                break;
            case ScatterTriangulationSeries.$$p[0]:
                let 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;
                }
                let 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;
        }
    }
    mi(a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    }
    mh(a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    }
    dw(a, b, c) {
        return super.dw(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;
    }
    m5() {
        if (this.trianglesSource == null) {
            this.mj = null;
            this.ma = null;
            this.mb = null;
            this.mc = null;
            this.mg = false;
        }
    }
    ib() {
        super.ib();
        if (this.l0 != null) {
            this.l0.g5();
        }
        if (this.l1 != null) {
            this.l1.g5();
        }
    }
    hy(a, b, c, d) {
        super.hy(a, b, c, d);
        this.m5();
        this.jd(false);
    }
    an(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;
    }
    jt(a, b) {
        this.jd(false);
    }
    js(a, b) {
        this.jd(false);
    }
    get ma() {
        return this.l4;
    }
    set ma(a) {
        let b = this.ma != a;
        if (b) {
            let c = this.ma;
            this.l4 = a;
            this.raisePropertyChanged("TriangleVertexColumn1", 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("TriangleVertexColumn2", c, this.mb);
        }
    }
    get mc() {
        return this.l6;
    }
    set mc(a) {
        let b = this.mc != a;
        if (b) {
            let c = this.mc;
            this.l6 = a;
            this.raisePropertyChanged("TriangleVertexColumn3", c, this.mc);
        }
    }
    get_c5() {
        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]]);
//# sourceMappingURL=ScatterTriangulationSeries.js.map