/*
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 { Base, Type, markType, runOn, EnumUtil, typeCast, fromEnum } from "igniteui-angular-core/ES2015/type";
import { IBucketizer_$type } from "./IBucketizer";
import { NotImplementedException } from "igniteui-angular-core/ES2015/NotImplementedException";
import { CategoryAngleAxis } from "./CategoryAngleAxis";
import { NumericRadiusAxis } from "./NumericRadiusAxis";
import { truncate } from "igniteui-angular-core/ES2015/number";
import { MarkerSeries } from "./MarkerSeries";
import { IHasCategoryModePreference_$type } from "./IHasCategoryModePreference";
import { SeriesRenderer$2 } from "./SeriesRenderer$2";
import { RadialFrame } from "./RadialFrame";
import { DependencyProperty } from "igniteui-angular-core/ES2015/DependencyProperty";
import { SeriesPointOfInterest } from "./SeriesPointOfInterest";
import { ScalerParams } from "./ScalerParams";
import { Marker } from "./Marker";
import { MarkerSeriesView } from "./MarkerSeriesView";
import { RadialAxes } from "./RadialAxes";
import { Visibility_$type } from "igniteui-angular-core/ES2015/Visibility";
import { SeriesRenderingArguments } from "./SeriesRenderingArguments";
import { PropertyMetadata } from "igniteui-angular-core/ES2015/PropertyMetadata";
import { Pool$1 } from "igniteui-angular-core/ES2015/Pool$1";
/**
 * @hidden
 */
export class RadialBucketCalculator extends Base {
    constructor(a) {
        super();
        this.a = null;
        this.c = 0;
        this.d = 0;
        this.b = 0;
        this.a = a;
    }
    getBucket(a) {
        throw new NotImplementedException(0);
    }
    getBucketWithoutUnknowns(a) {
        return this.getBucket(a);
    }
    getErrorBucket(a, b) {
        return NaN;
    }
    getBucketInfo(a, b, c, d) {
        a = this.c;
        b = this.d;
        c = this.b;
        d = this.a.cn.eu;
        return {
            p0: a,
            p1: b,
            p2: c,
            p3: d
        };
    }
    e(a) {
        let b = this.a.bs;
        let c = this.a.br;
        let d = this.a.cn.mz;
        if (b.isEmpty || c.isEmpty || d == null || this.a.cn.bz == null || this.a.cn.bz.count == 0) {
            this.b = 0;
            return;
        }
        let e = Math.floor(d.lc(c, b));
        let f = Math.ceil(d.lb(c, b));
        if (d.b8) {
            f = Math.ceil(d.lc(c, b));
            e = Math.floor(d.lb(c, b));
        }
        if (f < e) {
            f = d.jx + f;
        }
        let g = this.a.cn.m1;
        let h = g != null ? g.li : 0.75;
        let i = Math.min(c.width, c.height) * 0.5 * (h) * 2 * Math.PI;
        let j = Math.floor((f - e + 1) * a / i);
        this.b = truncate(Math.max(1, j));
        this.c = truncate(Math.max(0, Math.floor(e / this.b) - 1));
        this.d = truncate(Math.ceil(f / this.b));
    }
    cacheValues() {
    }
    unCacheValues() {
    }
}
RadialBucketCalculator.$t = markType(RadialBucketCalculator, 'RadialBucketCalculator', Base.$, [IBucketizer_$type]);
/**
 * @hidden
 */
export class RadialBase extends MarkerSeries {
    constructor() {
        super();
        this.m7 = null;
        this.m5 = new RadialFrame(3);
        this.m6 = new RadialFrame(3);
        this.m4 = new RadialFrame(3);
        this.m2 = null;
        this.m7 = new SeriesRenderer$2(RadialFrame.$, RadialBaseView.$, 1, runOn(this, this.nj), runOn(this, this.nk), runOn(this, this.ca), runOn(this, this.jk), runOn(this, this.ni), (a) => this.m3.co.e(this.eu));
    }
    it(a) {
        super.it(a);
        this.m3 = a;
    }
    ni() {
        if (this.bt.g) {
            this.bt.t();
        }
    }
    get categoryAxis() {
        return this.mz;
    }
    ap() {
        return this.mz;
    }
    nb(a) {
        if (!this.hasMarkers) {
            return false;
        }
        let b = this.mz;
        let c = new ScalerParams(1, this.bs.mq, this.lx, b.b8);
        c.c = this.getEffectiveViewport1(this.bi);
        let d = this.m1;
        let e = new ScalerParams(1, this.bs.mq, this.lx, d.b8);
        e.c = this.getEffectiveViewport1(this.bi);
        a.clear();
        this.lz.cc((f) => {
            if (f._visibility == 0) {
                let g = new SeriesPointOfInterest();
                let h = f.n;
                let i = f.o;
                if (h < this.lx.left || h > this.lx.right || i < this.lx.top || i > this.lx.bottom) {
                    return;
                }
                g.b = b.dy(h, c);
                g.c = d.dy(i, e);
                g.d = b.fi(f.ak);
                g.a = f.content;
                a.add(g);
            }
        });
        return true;
    }
    get_c2() {
        return true;
    }
    ag() {
        return [this.mz, this.m1];
    }
    js(a, b) {
        this.m3.co.e(this.eu);
        this.jc(false);
    }
    jr(a, b) {
        this.m3.co.e(this.eu);
        this.jc(false);
    }
    iy(a, b, c, d) {
        super.iy(a, b, c, d);
        switch (b) {
            case "SeriesViewer":
                if (c != null && d == null) {
                    if (this.mz != null) {
                        this.mz.bv(this);
                    }
                    if (this.m1 != null) {
                        this.m1.bv(this);
                    }
                }
                if (c == null && d != null) {
                    if (this.mz != null) {
                        this.mz.ch(this);
                    }
                    if (this.m1 != null) {
                        this.m1.ch(this);
                    }
                }
                this.m3.co.e(this.eu);
                this.jc(false);
                break;
            case RadialBase.$$p[0]:
                if (this.mz != null && this.m1 != null) {
                    this.m2 = new RadialAxes(this.m1, this.mz);
                }
                if (c != null) {
                    c.bv(this);
                }
                if (d != null) {
                    d.ch(this);
                }
                this.m3.co.e(this.eu);
                this.jc(false);
                break;
            case RadialBase.$$p[2]:
                if (this.mz != null && this.m1 != null) {
                    this.m2 = new RadialAxes(this.m1, this.mz);
                }
                if (c != null) {
                    c.bv(this);
                }
                if (d != null) {
                    d.ch(this);
                }
                this.m3.co.e(this.eu);
                if (this.m1 == null || !this.m1.ck()) {
                    this.jc(false);
                }
                break;
            case "SyncLink":
                if (this.bn != null && this.bs != null) {
                    this.m3.co.e(this.eu);
                    this.jc(false);
                }
                break;
            case "TransitionProgress":
                this.m6.c(this.ez, this.m5, this.m4);
                if (this.cc(this.bi)) {
                    return;
                }
                if (this.ez == 1) {
                    this.nk(this.m4, this.m3);
                }
                else {
                    this.nk(this.m6, this.m3);
                }
                if (this.bs != null) {
                    this.bs.jj(this);
                }
                break;
            case RadialBase.$$p[1]:
                this.jc(false);
                this.ij();
                break;
            case "VisibilityProxy":
                if (EnumUtil.getEnumValue(Visibility_$type, c) != 0 && EnumUtil.getEnumValue(Visibility_$type, d) == 0) {
                    this.m3.co.e(this.eu);
                }
                break;
        }
    }
    m9(a) {
        if (typeCast(NumericRadiusAxis.$, a) !== null) {
            return true;
        }
        return false;
    }
    m8(a) {
        if (typeCast(CategoryAngleAxis.$, a) !== null) {
            return true;
        }
        return false;
    }
    fp(a) {
        let b = this.e8(a);
        return b >= 0 && this.bz != null && b < this.bz.count ? this.bz.item(b) : null;
    }
    nc(a) {
        let b = this.bi.bs;
        let c = this.bi.br;
        if (this.mz != null && !b.isEmpty && !c.isEmpty && this.m2 != null) {
            let d = this.m2.c(a);
            if (d < 0) {
                d += Math.PI * 2;
            }
            if (d > Math.PI * 2) {
                d -= Math.PI * 2;
            }
            return d;
        }
        return NaN;
    }
    nd(a) {
        let b = this.bi.bs;
        let c = this.bi.br;
        let d = -1;
        if (this.mz != null && !b.isEmpty && !c.isEmpty && this.m2 != null) {
            let e = this.m2.c(a);
            if (e < 0) {
                e += Math.PI * 2;
            }
            if (e > Math.PI * 2) {
                e -= Math.PI * 2;
            }
            let f = this.mz.getUnscaledAngle(e);
            if (this.mz.categoryMode != 0) {
                f -= 0.5;
            }
            d = f;
        }
        return d;
    }
    e8(a) {
        let b = truncate(Math.round(this.nd(a)));
        if (this.bz != null && b == this.bz.count) {
            b = 0;
        }
        return b;
    }
    c9(a) {
        return false;
    }
    ia() {
        super.ia();
        if (this.mz != null) {
            this.mz.g5(false);
        }
        if (this.m1 != null) {
            this.m1.g5(false);
        }
    }
    dw(a, b, c) {
        let d = true;
        let e = c;
        if (!super.dw(a, b, c) || !c.l() || b.isEmpty || a.isEmpty || this.mz == null || this.mz.itemsSource == null || this.m1 == null || this.m2 == null || this.bz == null || this.mz.bf == null || this.m1.bf == null || this.m1.j3 == this.m1.j2) {
            e.co.b = 0;
            d = false;
        }
        return d;
    }
    jd(a) {
        let b;
        let c;
        let d = this.getViewInfo(c, b);
        c = d.p0;
        b = d.p1;
        if (!this.dw(c, b, this.bi)) {
            this.hv(true, this.bi);
            return;
        }
        let e = new SeriesRenderingArguments(this, c, b, a, this.de);
        let f = this.m7.g(e, this.m5, this.m4, this.m6, this.m3);
        this.m5 = f.p1;
        this.m4 = f.p2;
        this.m6 = f.p3;
    }
    ne() {
        let a = 0;
        for (let b of fromEnum(this.bs.series)) {
            if (b == this) {
                return a;
            }
            let c = typeCast(RadialBase.$, b);
            if (c != null && c.mz == this.mz && c.preferredCategoryMode(c.mz) == 2) {
                a++;
            }
        }
        return -1;
    }
}
RadialBase.$t = markType(RadialBase, 'RadialBase', MarkerSeries.$, [IHasCategoryModePreference_$type]);
Type.dep(DependencyProperty, PropertyMetadata, RadialBase, 'raisePropertyChanged', ['AngleAxis:mz:nl', [CategoryAngleAxis.$, null], 'ClipSeriesToBounds:na:nm', [0, false], 'ValueAxis:m1:nn', [NumericRadiusAxis.$, null]]);
/**
 * @hidden
 */
export class RadialBaseView extends MarkerSeriesView {
    constructor(a) {
        super(a);
        this.co = null;
        this.cn = null;
        this.cp = null;
        this.cq = 0;
        this.cr = null;
        this.cn = a;
        this.cp = new Pool$1(Marker.$);
        this.cf(this.cp);
    }
    cc(a) {
        this.cp.c(a);
    }
}
RadialBaseView.$t = markType(RadialBaseView, 'RadialBaseView', MarkerSeriesView.$);
//# sourceMappingURL=RadialBucketCalculator_combined.js.map