import { __extends } from "tslib";
import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { ShapeItemSearchMode_$type } from "./ShapeItemSearchMode";
import { IgrNumericXAxis } from "./igr-numeric-x-axis";
import { IgrNumericYAxis } from "./igr-numeric-y-axis";
import { IgrAssigningShapeStyleEventArgs } from "./igr-assigning-shape-style-event-args";
import { IgrAssigningShapeMarkerStyleEventArgs } from "./igr-assigning-shape-marker-style-event-args";
import { IgrStyleShapeEventArgs } from "./igr-style-shape-event-args";
import { IgrSeries } from "./igr-series";
import { ensureBool, ensureEnum, toPoint, fromPoint } from "igniteui-react-core";
/**
 * Series class for rendering polygons.
*/
var IgrShapeSeriesBase = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(IgrShapeSeriesBase, _super);
    function IgrShapeSeriesBase(props) {
        var _this = _super.call(this, props) || this;
        _this._xAxisName = null;
        _this._yAxisName = null;
        _this._assigningShapeStyle = null;
        _this._assigningShapeStyle_wrapped = null;
        _this._assigningShapeMarkerStyle = null;
        _this._assigningShapeMarkerStyle_wrapped = null;
        _this._styleShape = null;
        _this._styleShape_wrapped = null;
        return _this;
    }
    Object.defineProperty(IgrShapeSeriesBase.prototype, "i", {
        /**
                                     * @hidden
                                     */
        get: function () {
            return this._implementation;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrShapeSeriesBase.prototype, "isCustomShapeStyleAllowed", {
        /**
         * Gets or sets whether this Shape series should allow custom style overrides of its individual visuals.
        */
        get: function () {
            return this.i.u4;
        },
        set: function (v) {
            this.i.u4 = ensureBool(v);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrShapeSeriesBase.prototype, "isCustomShapeMarkerStyleAllowed", {
        /**
         * Gets or sets whether this Shape series should allow custom style overrides of its individual marker visuals.
        */
        get: function () {
            return this.i.u3;
        },
        set: function (v) {
            this.i.u3 = ensureBool(v);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrShapeSeriesBase.prototype, "actualItemSearchMode", {
        get: function () {
            return this.i.uj;
        },
        set: function (v) {
            this.i.uj = ensureEnum(ShapeItemSearchMode_$type, v);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrShapeSeriesBase.prototype, "itemSearchMode", {
        /**
         * Gets or sets the mode the series will use to find the closest point to the cursor.
        */
        get: function () {
            return this.i.ul;
        },
        set: function (v) {
            this.i.ul = ensureEnum(ShapeItemSearchMode_$type, v);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrShapeSeriesBase.prototype, "itemSearchThreshold", {
        /**
         * Gets or sets the threshold to use when searching for items using ItemSearchMode.
        */
        get: function () {
            return this.i.vm;
        },
        set: function (v) {
            this.i.vm = +v;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrShapeSeriesBase.prototype, "itemSearchPointsThreshold", {
        /**
         * Gets or sets the points threshold to use when searching for items using ItemSearchMode.
        */
        get: function () {
            return this.i.vl;
        },
        set: function (v) {
            this.i.vl = +v;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrShapeSeriesBase.prototype, "shapeMemberPath", {
        /**
         * The name of the property on ItemsSource items which, for each shape, contains a list of points to be converted to a polygon.
         * To be consistent with the Shapefile technical description, it is expected that each list of points is defined as an IEnumerable of IEnumerable of Point, or in other words, a list of lists of points.
        */
        get: function () {
            return this.i.vy;
        },
        set: function (v) {
            this.i.vy = v;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrShapeSeriesBase.prototype, "highlightedShapeMemberPath", {
        /**
         * Gets or sets the value mapping property for the current series object.
        */
        get: function () {
            return this.i.vp;
        },
        set: function (v) {
            this.i.vp = v;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrShapeSeriesBase.prototype, "xAxis", {
        /**
         * Gets or sets the effective x-axis for the current ScatterBase object.
        */
        get: function () {
            var r = this.i.uf;
            if (r == null) {
                return null;
            }
            if (!r.externalObject) {
                var e = IgrNumericXAxis._createFromInternal(r);
                if (e) {
                    e._implementation = r;
                }
                r.externalObject = e;
            }
            return r.externalObject;
        },
        set: function (v) {
            if (v != null && this._stylingContainer && v._styling)
                v._styling(this._stylingContainer, this, this);
            v == null ? this.i.uf = null : this.i.uf = v.i;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrShapeSeriesBase.prototype, "xAxisName", {
        /**
        * Gets or sets the name to use to resolve xAxis from markup.
        */
        get: function () {
            return this._xAxisName;
        },
        set: function (v) {
            this._xAxisName = v;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrShapeSeriesBase.prototype, "yAxis", {
        /**
         * Gets or sets the effective y-axis for the current ScatterBase object.
        */
        get: function () {
            var r = this.i.uh;
            if (r == null) {
                return null;
            }
            if (!r.externalObject) {
                var e = IgrNumericYAxis._createFromInternal(r);
                if (e) {
                    e._implementation = r;
                }
                r.externalObject = e;
            }
            return r.externalObject;
        },
        set: function (v) {
            if (v != null && this._stylingContainer && v._styling)
                v._styling(this._stylingContainer, this, this);
            v == null ? this.i.uh = null : this.i.uh = v.i;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrShapeSeriesBase.prototype, "yAxisName", {
        /**
        * Gets or sets the name to use to resolve yAxis from markup.
        */
        get: function () {
            return this._yAxisName;
        },
        set: function (v) {
            this._yAxisName = v;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrShapeSeriesBase.prototype, "shapeFilterResolution", {
        /**
         * The resolution at which to filter out shapes in the series.  For example, if the ShapeFilterResolution is set to 3, then elements with a bounding rectangle smaller than 3 X 3 pixels will be filtered out.
         * In the case of ScatterPolylineSeries, the resolution is compared to either dimension, rather than both.  In other words, a polyline will not be filtered if its height or its width exceeds the value of this property.  Whereas with a ShapeSeries, both the height and the width must exceed the value of this property.
        */
        get: function () {
            return this.i.vi;
        },
        set: function (v) {
            this.i.vi = +v;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrShapeSeriesBase.prototype, "isShape", {
        /**
         * Gets whether or not this series is a shape series
        */
        get: function () {
            return this.i.fb;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrShapeSeriesBase.prototype, "isMarkerlessDisplayPreferred", {
        /**
         * Overridden by derived series classes to indicate when marker-less display is preferred or not.
        */
        get: function () {
            return this.i.ez;
        },
        enumerable: false,
        configurable: true
    });
    IgrShapeSeriesBase.prototype.bindAxes = function (axes) {
        _super.prototype.bindAxes.call(this, axes);
        for (var i = 0; i < axes.length; i++) {
            if (this.xAxisName && this.xAxisName.length > 0 &&
                axes[i].name == this.xAxisName) {
                this.xAxis = axes[i];
            }
        }
        for (var i = 0; i < axes.length; i++) {
            if (this.yAxisName && this.yAxisName.length > 0 &&
                axes[i].name == this.yAxisName) {
                this.yAxis = axes[i];
            }
        }
    };
    IgrShapeSeriesBase.prototype.findByName = function (name) {
        var baseResult = _super.prototype.findByName.call(this, name);
        if (baseResult) {
            return baseResult;
        }
        if (this.xAxis && this.xAxis.name && this.xAxis.name == name) {
            return this.xAxis;
        }
        if (this.yAxis && this.yAxis.name && this.yAxis.name == name) {
            return this.yAxis;
        }
        return null;
    };
    IgrShapeSeriesBase.prototype._styling = function (container, component, parent) {
        _super.prototype._styling.call(this, container, component, parent);
        this._inStyling = true;
        if (this.xAxis && this.xAxis._styling) {
            this.xAxis._styling(container, component, this);
        }
        if (this.yAxis && this.yAxis._styling) {
            this.yAxis._styling(container, component, this);
        }
        this._inStyling = false;
    };
    IgrShapeSeriesBase.prototype.getItemValue = function (item, memberPathName) {
        var iv = this.i.jv(item, memberPathName);
        return (iv);
    };
    IgrShapeSeriesBase.prototype.getExactItemIndex = function (world) {
        var iv = this.i.hw(toPoint(world));
        return (iv);
    };
    IgrShapeSeriesBase.prototype.getSeriesValuePosition = function (world, useInterpolation, skipUnknowns) {
        var iv = this.i.tj(toPoint(world), useInterpolation, skipUnknowns);
        return fromPoint(iv);
    };
    /**
     * Gets the item that is the best match for the specified world coordinates.
    
    * @param world  * The world coordinates to use.
    */
    IgrShapeSeriesBase.prototype.getItem = function (world) {
        var iv = this.i.js(toPoint(world));
        return (iv);
    };
    /**
     * Determine if object can be used as YAxis
    
    * @param axis  * The object to check
    */
    IgrShapeSeriesBase.prototype.canUseAsYAxis = function (axis) {
        var iv = this.i.uz(axis);
        return (iv);
    };
    /**
     * Determine if object can be used as XAxis
    
    * @param axis  * The object to check
    */
    IgrShapeSeriesBase.prototype.canUseAsXAxis = function (axis) {
        var iv = this.i.uy(axis);
        return (iv);
    };
    Object.defineProperty(IgrShapeSeriesBase.prototype, "assigningShapeStyle", {
        /**
         * Event raised when Assigning Shape Style. Note, if using this event, or highlighting, its best to avoid use of ShapeStyle/StyleShape/ShapeStyleSelector.
        */
        get: function () {
            return this._assigningShapeStyle;
        },
        set: function (ev) {
            var _this = this;
            if (this._assigningShapeStyle_wrapped !== null) {
                this.i.assigningShapeStyle = delegateRemove(this.i.assigningShapeStyle, this._assigningShapeStyle_wrapped);
                this._assigningShapeStyle_wrapped = null;
                this._assigningShapeStyle = null;
            }
            this._assigningShapeStyle = ev;
            this._assigningShapeStyle_wrapped = function (o, e) {
                var outerArgs = new IgrAssigningShapeStyleEventArgs();
                outerArgs._provideImplementation(e);
                if (_this.beforeAssigningShapeStyle) {
                    _this.beforeAssigningShapeStyle(_this, outerArgs);
                }
                if (_this._assigningShapeStyle) {
                    _this._assigningShapeStyle(_this, outerArgs);
                }
            };
            this.i.assigningShapeStyle = delegateCombine(this.i.assigningShapeStyle, this._assigningShapeStyle_wrapped);
            ;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrShapeSeriesBase.prototype, "assigningShapeMarkerStyle", {
        /**
         * Event raised when Assigning Shape Marker Style
        */
        get: function () {
            return this._assigningShapeMarkerStyle;
        },
        set: function (ev) {
            var _this = this;
            if (this._assigningShapeMarkerStyle_wrapped !== null) {
                this.i.assigningShapeMarkerStyle = delegateRemove(this.i.assigningShapeMarkerStyle, this._assigningShapeMarkerStyle_wrapped);
                this._assigningShapeMarkerStyle_wrapped = null;
                this._assigningShapeMarkerStyle = null;
            }
            this._assigningShapeMarkerStyle = ev;
            this._assigningShapeMarkerStyle_wrapped = function (o, e) {
                var outerArgs = new IgrAssigningShapeMarkerStyleEventArgs();
                outerArgs._provideImplementation(e);
                if (_this.beforeAssigningShapeMarkerStyle) {
                    _this.beforeAssigningShapeMarkerStyle(_this, outerArgs);
                }
                if (_this._assigningShapeMarkerStyle) {
                    _this._assigningShapeMarkerStyle(_this, outerArgs);
                }
            };
            this.i.assigningShapeMarkerStyle = delegateCombine(this.i.assigningShapeMarkerStyle, this._assigningShapeMarkerStyle_wrapped);
            ;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(IgrShapeSeriesBase.prototype, "styleShape", {
        /**
         * Raised when tile's image URI should be provided
        */
        get: function () {
            return this._styleShape;
        },
        set: function (ev) {
            var _this = this;
            if (this._styleShape_wrapped !== null) {
                this.i.styleShape = delegateRemove(this.i.styleShape, this._styleShape_wrapped);
                this._styleShape_wrapped = null;
                this._styleShape = null;
            }
            this._styleShape = ev;
            this._styleShape_wrapped = function (o, e) {
                var outerArgs = new IgrStyleShapeEventArgs();
                outerArgs._provideImplementation(e);
                if (_this.beforeStyleShape) {
                    _this.beforeStyleShape(_this, outerArgs);
                }
                if (_this._styleShape) {
                    _this._styleShape(_this, outerArgs);
                }
            };
            this.i.styleShape = delegateCombine(this.i.styleShape, this._styleShape_wrapped);
            ;
        },
        enumerable: false,
        configurable: true
    });
    return IgrShapeSeriesBase;
}(IgrSeries));
export { IgrShapeSeriesBase };
