/*
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.er;
        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.ms;
        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.k6(c, b));
        let f = Math.ceil(d.k5(c, b));
        if (d.b8) {
            f = Math.ceil(d.k6(c, b));
            e = Math.floor(d.k5(c, b));
        }
        if (f < e) {
            f = d.jr + f;
        }
        let g = this.a.cn.mu;
        let h = g != null ? g.lc : 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.m0 = null;
        this.my = new RadialFrame(3);
        this.mz = new RadialFrame(3);
        this.mx = new RadialFrame(3);
        this.mv = null;
        this.m0 = new SeriesRenderer$2(RadialFrame.$, RadialBaseView.$, 1, runOn(this, this.nc), runOn(this, this.nd), runOn(this, this.ca), runOn(this, this.jd), runOn(this, this.nb), (a) => this.mw.co.e(this.er));
    }
    im(a) {
        super.im(a);
        this.mw = a;
    }
    nb() {
        if (this.bt.g) {
            this.bt.t();
        }
    }
    get categoryAxis() {
        return this.ms;
    }
    ap() {
        return this.ms;
    }
    m4(a) {
        if (!this.hasMarkers) {
            return false;
        }
        let b = this.ms;
        let c = new ScalerParams(1, this.bs.mq, this.lq, b.b8);
        c.c = this.getEffectiveViewport1(this.bi);
        let d = this.mu;
        let e = new ScalerParams(1, this.bs.mq, this.lq, d.b8);
        e.c = this.getEffectiveViewport1(this.bi);
        a.clear();
        this.ls.cc((f) => {
            if (f._visibility == 0) {
                let g = new SeriesPointOfInterest();
                let h = f.n;
                let i = f.o;
                if (h < this.lq.left || h > this.lq.right || i < this.lq.top || i > this.lq.bottom) {
                    return;
                }
                g.b = b.dw(h, c);
                g.c = d.dw(i, e);
                g.d = b.fe(f.ak);
                g.a = f.content;
                a.add(g);
            }
        });
        return true;
    }
    get_c2() {
        return true;
    }
    ag() {
        return [this.ms, this.mu];
    }
    jl(a, b) {
        this.mw.co.e(this.er);
        this.i5(false);
    }
    jk(a, b) {
        this.mw.co.e(this.er);
        this.i5(false);
    }
    is(a, b, c, d) {
        super.is(a, b, c, d);
        switch (b) {
            case "SeriesViewer":
                if (c != null && d == null) {
                    if (this.ms != null) {
                        this.ms.bv(this);
                    }
                    if (this.mu != null) {
                        this.mu.bv(this);
                    }
                }
                if (c == null && d != null) {
                    if (this.ms != null) {
                        this.ms.ch(this);
                    }
                    if (this.mu != null) {
                        this.mu.ch(this);
                    }
                }
                this.mw.co.e(this.er);
                this.i5(false);
                break;
            case RadialBase.$$p[0]:
                if (this.ms != null && this.mu != null) {
                    this.mv = new RadialAxes(this.mu, this.ms);
                }
                if (c != null) {
                    c.bv(this);
                }
                if (d != null) {
                    d.ch(this);
                }
                this.mw.co.e(this.er);
                this.i5(false);
                break;
            case RadialBase.$$p[2]:
                if (this.ms != null && this.mu != null) {
                    this.mv = new RadialAxes(this.mu, this.ms);
                }
                if (c != null) {
                    c.bv(this);
                }
                if (d != null) {
                    d.ch(this);
                }
                this.mw.co.e(this.er);
                if (this.mu == null || !this.mu.ck()) {
                    this.i5(false);
                }
                break;
            case "SyncLink":
                if (this.bn != null && this.bs != null) {
                    this.mw.co.e(this.er);
                    this.i5(false);
                }
                break;
            case "TransitionProgress":
                this.mz.c(this.ew, this.my, this.mx);
                if (this.cc(this.bi)) {
                    return;
                }
                if (this.ew == 1) {
                    this.nd(this.mx, this.mw);
                }
                else {
                    this.nd(this.mz, this.mw);
                }
                if (this.bs != null) {
                    this.bs.jj(this);
                }
                break;
            case RadialBase.$$p[1]:
                this.i5(false);
                this.ic();
                break;
            case "VisibilityProxy":
                if (EnumUtil.getEnumValue(Visibility_$type, c) != 0 && EnumUtil.getEnumValue(Visibility_$type, d) == 0) {
                    this.mw.co.e(this.er);
                }
                break;
        }
    }
    m2(a) {
        if (typeCast(NumericRadiusAxis.$, a) !== null) {
            return true;
        }
        return false;
    }
    m1(a) {
        if (typeCast(CategoryAngleAxis.$, a) !== null) {
            return true;
        }
        return false;
    }
    fm(a) {
        let b = this.e5(a);
        return b >= 0 && this.bz != null && b < this.bz.count ? this.bz.item(b) : null;
    }
    m5(a) {
        let b = this.bi.bs;
        let c = this.bi.br;
        if (this.ms != null && !b.isEmpty && !c.isEmpty && this.mv != null) {
            let d = this.mv.c(a);
            if (d < 0) {
                d += Math.PI * 2;
            }
            if (d > Math.PI * 2) {
                d -= Math.PI * 2;
            }
            return d;
        }
        return NaN;
    }
    m6(a) {
        let b = this.bi.bs;
        let c = this.bi.br;
        let d = -1;
        if (this.ms != null && !b.isEmpty && !c.isEmpty && this.mv != null) {
            let e = this.mv.c(a);
            if (e < 0) {
                e += Math.PI * 2;
            }
            if (e > Math.PI * 2) {
                e -= Math.PI * 2;
            }
            let f = this.ms.getUnscaledAngle(e);
            if (this.ms.categoryMode != 0) {
                f -= 0.5;
            }
            d = f;
        }
        return d;
    }
    e5(a) {
        let b = truncate(Math.round(this.m6(a)));
        if (this.bz != null && b == this.bz.count) {
            b = 0;
        }
        return b;
    }
    c8(a) {
        return false;
    }
    h4() {
        super.h4();
        if (this.ms != null) {
            this.ms.g0(false);
        }
        if (this.mu != null) {
            this.mu.g0(false);
        }
    }
    dv(a, b, c) {
        let d = true;
        let e = c;
        if (!super.dv(a, b, c) || !c.l() || b.isEmpty || a.isEmpty || this.ms == null || this.ms.itemsSource == null || this.mu == null || this.mv == null || this.bz == null || this.ms.bf == null || this.mu.bf == null || this.mu.jx == this.mu.jw) {
            e.co.b = 0;
            d = false;
        }
        return d;
    }
    i6(a) {
        let b;
        let c;
        let d = this.getViewInfo(c, b);
        c = d.p0;
        b = d.p1;
        if (!this.dv(c, b, this.bi)) {
            this.hp(true, this.bi);
            return;
        }
        let e = new SeriesRenderingArguments(this, c, b, a, this.dd);
        let f = this.m0.g(e, this.my, this.mx, this.mz, this.mw);
        this.my = f.p1;
        this.mx = f.p2;
        this.mz = f.p3;
    }
    m7() {
        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.ms == this.ms && c.preferredCategoryMode(c.ms) == 2) {
                a++;
            }
        }
        return -1;
    }
}
RadialBase.$t = markType(RadialBase, 'RadialBase', MarkerSeries.$, [IHasCategoryModePreference_$type]);
Type.dep(DependencyProperty, PropertyMetadata, RadialBase, 'raisePropertyChanged', ['AngleAxis:ms:ne', [CategoryAngleAxis.$, null], 'ClipSeriesToBounds:m3:nf', [0, false], 'ValueAxis:mu:ng', [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