/*
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 { AnchoredRadialSeries } from "./AnchoredRadialSeries";
import { DependencyProperty } from "igniteui-angular-core";
import { Point_$type, markType, markDep, runOn, fromEnum } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { PathGeometry } from "igniteui-angular-core";
import { PathFigure } from "igniteui-angular-core";
import { PolyLineSegment } from "igniteui-angular-core";
import { ViewportUtils } from "./ViewportUtils";
import { PropertyMetadata } from "igniteui-angular-core";
import { AnchoredRadialSeriesView } from "./AnchoredRadialSeriesView";
/**
 * @hidden
 */
export class RadialColumnSeries extends AnchoredRadialSeries {
    constructor() {
        super();
        this.ab = RadialColumnSeries.$;
    }
    bf() {
        return new RadialColumnSeriesView(this);
    }
    iu(a) {
        super.iu(a);
        this.oq = a;
    }
    ac() {
        super.ac();
        this.jd(false);
    }
    preferredCategoryMode(a) {
        return a != null && a == this.m0 ? 2 : 0;
    }
    hv(a, b) {
        super.hv(a, b);
        let c = b;
        if (a) {
            c.cx.count = 0;
        }
    }
    eg() {
        return this.m0.jr(this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi));
    }
    nl(a, b) {
        super.nl(a, b);
        let c = a.f;
        let d = b.bs;
        let e = b.br;
        let f = this.getEffectiveViewport1(b);
        let g = this.lq(b);
        let h = this.m2.jg(e, d, f, g);
        let i = b;
        let j = this.m2;
        let k = Math.max(0, 0.5 * j.li);
        k = Math.max(k, h.minLength * 0.9);
        let l = ViewportUtils.d(k, d, e);
        let m = this.m0.jr(d, e, f);
        let n = Math.max(0.1 * this.m2.lj, k);
        let o = this.m3.d(0, n, d, e);
        let p = this.m3.e(0, n, d, e);
        let q = this.m3.d(m, n, d, e);
        let r = this.m3.e(m, n, d, e);
        let s = Math.sqrt((o - q) * (o - q) + (p - r) * (p - r));
        let t = { $type: Point_$type, x: ViewportUtils.c(0.5, d, e), y: ViewportUtils.f(0.5, d, e) };
        for (let u = 0; u < c.count; ++u) {
            let v = Math.min(a.f._inner[u][2], h.maxLength * 1.1);
            let w = this.m3.d(a.f._inner[u][0], v, d, e);
            let x = this.m3.e(a.f._inner[u][0], v, d, e);
            let y = Math.sqrt((w - t.x) * (w - t.x) + (x - t.y) * (x - t.y));
            let z = y;
            let aa = l;
            let ab = a.f._inner[u][0] - (Math.PI / 2);
            let ac = i.cx.item(u);
            let ad = 0 - (s / 2);
            let ae = (s / 2);
            let af = Math.max(aa, z);
            let ag = Math.min(aa, z);
            let ah = Math.cos(ab);
            let ai = Math.sin(ab);
            let aj = { $type: Point_$type, x: t.x + (ad * ah - af * ai), y: t.y + (ad * ai + af * ah) };
            let ak = { $type: Point_$type, x: t.x + (ae * ah - af * ai), y: t.y + (ae * ai + af * ah) };
            let al = { $type: Point_$type, x: t.x + (ae * ah - ag * ai), y: t.y + (ae * ai + ag * ah) };
            let am = { $type: Point_$type, x: t.x + (ad * ah - ag * ai), y: t.y + (ad * ai + ag * ah) };
            let an = new PathGeometry();
            let ao = new PathFigure();
            ao._startPoint = aj;
            ao._isClosed = true;
            let ap = new PolyLineSegment();
            ap._points.add(ak);
            ap._points.add(al);
            ap._points.add(am);
            ao._segments.add(ap);
            an.c.add(ao);
            ac.ak = an;
        }
        i.cx.count = c.count;
        this.oq.c2();
    }
}
RadialColumnSeries.$t = markType(RadialColumnSeries, 'RadialColumnSeries', AnchoredRadialSeries.$);
RadialColumnSeries.$$p = markDep(DependencyProperty, PropertyMetadata, RadialColumnSeries, 'raisePropertyChanged', ['RadiusX:or:ov', [1, 2], 'RadiusY:os:ow', [1, 2]]);
/**
 * @hidden
 */
export class RadialColumnSeriesView extends AnchoredRadialSeriesView {
    constructor(a) {
        super(a);
        this.cw = null;
        this.cx = null;
        this.cy = null;
        this.cw = a;
        this.cx = ((() => {
            let $ret = new Pool$1(Path.$);
            $ret.create = runOn(this, this.c4);
            $ret.activate = runOn(this, this.cz);
            $ret.disactivate = runOn(this, this.c1);
            $ret.destroy = runOn(this, this.c0);
            return $ret;
        })());
    }
    ap() {
        super.ap();
        this.cy = new List$1(Path.$, 0);
        if (!this.n) {
            this.e.eu = 4;
            this.e.bj = 1;
        }
    }
    c4() {
        let a = new Path();
        this.cy.add(a);
        a._visibility = 1;
        return a;
    }
    cz(a) {
        a._visibility = 0;
    }
    c1(a) {
        a._visibility = 1;
    }
    c0(a) {
        this.cy.remove(a);
    }
    c3(a, b, c, d, e, f) {
        this.an();
    }
    bb(a, b) {
        super.bb(a, b);
        let c = a;
        c._fill = this.e.k3;
        c._stroke = this.e.k4;
        c.ac = this.e.ey;
        c.ai = this.e.lb;
        c.ad = this.e.lc;
    }
    bc(a, b) {
        super.bc(a, b);
        let c = a;
        let d = this.bm(b);
        c._fill = d;
        c._stroke = d;
        c.ac = this.e.ey + 3;
    }
    a3(a, b) {
        super.a3(a, b);
        if (a.d) {
            for (let c = 0; c < this.cy.count; c++) {
                let d = this.cy._inner[c];
                this.ba(d, c, b);
                a.s(d);
            }
        }
    }
    ai(a) {
        super.ai(a);
        let b = 0;
        for (let c of fromEnum(this.cx.a)) {
            this.e.a2.exportPathData(a, c, "column" + b, ["Main", "Fill"]);
            b++;
        }
    }
    c2() {
        this.an();
    }
}
RadialColumnSeriesView.$t = markType(RadialColumnSeriesView, 'RadialColumnSeriesView', AnchoredRadialSeriesView.$);
//# sourceMappingURL=RadialColumnSeries_combined.js.map