/*
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 * as tslib_1 from "tslib";
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
 */
var RadialColumnSeries = /** @class */ (function (_super) {
    tslib_1.__extends(RadialColumnSeries, _super);
    function RadialColumnSeries() {
        var _this = _super.call(this) || this;
        _this.ab = RadialColumnSeries.$;
        return _this;
    }
    RadialColumnSeries.prototype.bf = function () {
        return new RadialColumnSeriesView(this);
    };
    RadialColumnSeries.prototype.iu = function (a) {
        _super.prototype.iu.call(this, a);
        this.oq = a;
    };
    RadialColumnSeries.prototype.ac = function () {
        _super.prototype.ac.call(this);
        this.jd(false);
    };
    RadialColumnSeries.prototype.preferredCategoryMode = function (a) {
        return a != null && a == this.m0 ? 2 : 0;
    };
    RadialColumnSeries.prototype.hv = function (a, b) {
        _super.prototype.hv.call(this, a, b);
        var c = b;
        if (a) {
            c.cx.count = 0;
        }
    };
    RadialColumnSeries.prototype.eg = function () {
        return this.m0.jr(this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi));
    };
    RadialColumnSeries.prototype.nl = function (a, b) {
        _super.prototype.nl.call(this, a, b);
        var c = a.f;
        var d = b.bs;
        var e = b.br;
        var f = this.getEffectiveViewport1(b);
        var g = this.lq(b);
        var h = this.m2.jg(e, d, f, g);
        var i = b;
        var j = this.m2;
        var k = Math.max(0, 0.5 * j.li);
        k = Math.max(k, h.minLength * 0.9);
        var l = ViewportUtils.d(k, d, e);
        var m = this.m0.jr(d, e, f);
        var n = Math.max(0.1 * this.m2.lj, k);
        var o = this.m3.d(0, n, d, e);
        var p = this.m3.e(0, n, d, e);
        var q = this.m3.d(m, n, d, e);
        var r = this.m3.e(m, n, d, e);
        var s = Math.sqrt((o - q) * (o - q) + (p - r) * (p - r));
        var t = { $type: Point_$type, x: ViewportUtils.c(0.5, d, e), y: ViewportUtils.f(0.5, d, e) };
        for (var u = 0; u < c.count; ++u) {
            var v = Math.min(a.f._inner[u][2], h.maxLength * 1.1);
            var w = this.m3.d(a.f._inner[u][0], v, d, e);
            var x = this.m3.e(a.f._inner[u][0], v, d, e);
            var y = Math.sqrt((w - t.x) * (w - t.x) + (x - t.y) * (x - t.y));
            var z = y;
            var aa = l;
            var ab = a.f._inner[u][0] - (Math.PI / 2);
            var ac = i.cx.item(u);
            var ad = 0 - (s / 2);
            var ae = (s / 2);
            var af = Math.max(aa, z);
            var ag = Math.min(aa, z);
            var ah = Math.cos(ab);
            var ai = Math.sin(ab);
            var aj = { $type: Point_$type, x: t.x + (ad * ah - af * ai), y: t.y + (ad * ai + af * ah) };
            var ak = { $type: Point_$type, x: t.x + (ae * ah - af * ai), y: t.y + (ae * ai + af * ah) };
            var al = { $type: Point_$type, x: t.x + (ae * ah - ag * ai), y: t.y + (ae * ai + ag * ah) };
            var am = { $type: Point_$type, x: t.x + (ad * ah - ag * ai), y: t.y + (ad * ai + ag * ah) };
            var an = new PathGeometry();
            var ao = new PathFigure();
            ao._startPoint = aj;
            ao._isClosed = true;
            var 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]]);
    return RadialColumnSeries;
}(AnchoredRadialSeries));
export { RadialColumnSeries };
/**
 * @hidden
 */
var RadialColumnSeriesView = /** @class */ (function (_super) {
    tslib_1.__extends(RadialColumnSeriesView, _super);
    function RadialColumnSeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.cw = null;
        _this.cx = null;
        _this.cy = null;
        _this.cw = a;
        _this.cx = ((function () {
            var $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;
        })());
        return _this;
    }
    RadialColumnSeriesView.prototype.ap = function () {
        _super.prototype.ap.call(this);
        this.cy = new List$1(Path.$, 0);
        if (!this.n) {
            this.e.eu = 4;
            this.e.bj = 1;
        }
    };
    RadialColumnSeriesView.prototype.c4 = function () {
        var a = new Path();
        this.cy.add(a);
        a._visibility = 1;
        return a;
    };
    RadialColumnSeriesView.prototype.cz = function (a) {
        a._visibility = 0;
    };
    RadialColumnSeriesView.prototype.c1 = function (a) {
        a._visibility = 1;
    };
    RadialColumnSeriesView.prototype.c0 = function (a) {
        this.cy.remove(a);
    };
    RadialColumnSeriesView.prototype.c3 = function (a, b, c, d, e, f) {
        this.an();
    };
    RadialColumnSeriesView.prototype.bb = function (a, b) {
        _super.prototype.bb.call(this, a, b);
        var 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;
    };
    RadialColumnSeriesView.prototype.bc = function (a, b) {
        _super.prototype.bc.call(this, a, b);
        var c = a;
        var d = this.bm(b);
        c._fill = d;
        c._stroke = d;
        c.ac = this.e.ey + 3;
    };
    RadialColumnSeriesView.prototype.a3 = function (a, b) {
        _super.prototype.a3.call(this, a, b);
        if (a.d) {
            for (var c = 0; c < this.cy.count; c++) {
                var d = this.cy._inner[c];
                this.ba(d, c, b);
                a.s(d);
            }
        }
    };
    RadialColumnSeriesView.prototype.ai = function (a) {
        var e_1, _a;
        _super.prototype.ai.call(this, a);
        var b = 0;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.cx.a)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var c = _c.value;
                this.e.a2.exportPathData(a, c, "column" + b, ["Main", "Fill"]);
                b++;
            }
        }
        catch (e_1_1) { e_1 = { error: e_1_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_1) throw e_1.error; }
        }
    };
    RadialColumnSeriesView.prototype.c2 = function () {
        this.an();
    };
    RadialColumnSeriesView.$t = markType(RadialColumnSeriesView, 'RadialColumnSeriesView', AnchoredRadialSeriesView.$);
    return RadialColumnSeriesView;
}(AnchoredRadialSeriesView));
export { RadialColumnSeriesView };
//# sourceMappingURL=RadialColumnSeries_combined.js.map