/*
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.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;
    }
    hn() {
        super.hn();
        this.ls = null;
        this.lt = null;
    }
    get l5() {
        return this.lz;
    }
    set l5(a) {
        let b = this.l5 != a;
        if (b) {
            let c = this.l5;
            this.lz = a;
            this.raisePropertyChanged("XColumn", c, this.l5);
        }
    }
    get l6() {
        return this.l0;
    }
    set l6(a) {
        let b = this.l6 != a;
        if (b) {
            let c = this.l6;
            this.l0 = a;
            this.raisePropertyChanged("YColumn", c, this.l6);
        }
    }
    i6(a) {
        let 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;
        }
    }
    my() {
        this.lv = new Triangulator(this.bz.count, this.l5, this.l6);
        let a = this.lv;
        a.triangulationStatusChanged = delegateCombine(a.triangulationStatusChanged, runOn(this, this.mz));
        this.lv.y();
    }
    mw() {
        if (this.lv == null) {
            return;
        }
        this.lv.r();
        let a = this.lv;
        a.triangulationStatusChanged = delegateRemove(a.triangulationStatusChanged, runOn(this, this.mz));
        this.lv = null;
    }
    mz(a, b) {
        if (this.triangulationStatusChanged != null) {
            this.triangulationStatusChanged(this, new TriangulationStatusEventArgs(b.currentStatus));
        }
        if (b.currentStatus >= 100) {
            if (this.lv == null) {
                return;
            }
            let c = this.lv;
            c.triangulationStatusChanged = delegateRemove(c.triangulationStatusChanged, runOn(this, this.mz));
            this.mb = this.lv.n();
            this.lv = null;
            let d = ((() => {
                let $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);
        }
    }
    l1(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);
    }
    is(a, b, c, d) {
        super.is(a, b, c, d);
        switch (b) {
            case "FastItemsSource":
                let e = typeCast(IFastItemsSource_$type, c);
                if (e != null) {
                    e.deregisterColumn(this.l5);
                    e.deregisterColumn(this.l6);
                    this.l5 = null;
                    this.l6 = null;
                }
                this.mx();
                let 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 = ((() => {
                        let $ret = new FastItemsSource();
                        $ret.e = this.trianglesSource;
                        return $ret;
                    })());
                }
                else {
                    this.l7 = null;
                }
                break;
            case ScatterTriangulationSeries.$$p[0]:
                let 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;
                }
                let 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;
        }
    }
    ma(a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    }
    l9(a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    }
    dv(a, b, c) {
        return super.dv(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;
    }
    mx() {
        if (this.trianglesSource == null) {
            this.mb = null;
            this.l2 = null;
            this.l3 = null;
            this.l4 = null;
            this.l8 = false;
        }
    }
    h4() {
        super.h4();
        if (this.ls != null) {
            this.ls.gz();
        }
        if (this.lt != null) {
            this.lt.gz();
        }
    }
    hs(a, b, c, d) {
        super.hs(a, b, c, d);
        this.mx();
        this.i5(false);
    }
    an(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;
    }
    jl(a, b) {
        this.i5(false);
    }
    jk(a, b) {
        this.i5(false);
    }
    get l2() {
        return this.lw;
    }
    set l2(a) {
        let b = this.l2 != a;
        if (b) {
            let c = this.l2;
            this.lw = a;
            this.raisePropertyChanged("TriangleVertexColumn1", c, this.l2);
        }
    }
    get l3() {
        return this.lx;
    }
    set l3(a) {
        let b = this.l3 != a;
        if (b) {
            let c = this.l3;
            this.lx = a;
            this.raisePropertyChanged("TriangleVertexColumn2", c, this.l3);
        }
    }
    get l4() {
        return this.ly;
    }
    set l4(a) {
        let b = this.l4 != a;
        if (b) {
            let c = this.l4;
            this.ly = a;
            this.raisePropertyChanged("TriangleVertexColumn3", c, this.l4);
        }
    }
    get_c5() {
        return true;
    }
}
ScatterTriangulationSeries.$t = markType(ScatterTriangulationSeries, 'ScatterTriangulationSeries', Series.$);
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