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.
*/
export class IgrShapeSeriesBase extends IgrSeries {
    /**
                                 * @hidden
                                 */
    get i() {
        return this._implementation;
    }
    constructor(props) {
        super(props);
        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;
    }
    /**
     * Gets or sets whether this Shape series should allow custom style overrides of its individual visuals.
    */
    get isCustomShapeStyleAllowed() {
        return this.i.u2;
    }
    set isCustomShapeStyleAllowed(v) {
        this.i.u2 = ensureBool(v);
    }
    /**
     * Gets or sets whether this Shape series should allow custom style overrides of its individual marker visuals.
    */
    get isCustomShapeMarkerStyleAllowed() {
        return this.i.u1;
    }
    set isCustomShapeMarkerStyleAllowed(v) {
        this.i.u1 = ensureBool(v);
    }
    get actualItemSearchMode() {
        return this.i.um;
    }
    set actualItemSearchMode(v) {
        this.i.um = ensureEnum(ShapeItemSearchMode_$type, v);
    }
    /**
     * Gets or sets the mode the series will use to find the closest point to the cursor.
    */
    get itemSearchMode() {
        return this.i.uo;
    }
    set itemSearchMode(v) {
        this.i.uo = ensureEnum(ShapeItemSearchMode_$type, v);
    }
    /**
     * Gets or sets the threshold to use when searching for items using ItemSearchMode.
    */
    get itemSearchThreshold() {
        return this.i.vk;
    }
    set itemSearchThreshold(v) {
        this.i.vk = +v;
    }
    /**
     * Gets or sets the points threshold to use when searching for items using ItemSearchMode.
    */
    get itemSearchPointsThreshold() {
        return this.i.vj;
    }
    set itemSearchPointsThreshold(v) {
        this.i.vj = +v;
    }
    /**
     * 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 shapeMemberPath() {
        return this.i.vw;
    }
    set shapeMemberPath(v) {
        this.i.vw = v;
    }
    /**
     * Gets or sets the value mapping property for the current series object.
    */
    get highlightedShapeMemberPath() {
        return this.i.vn;
    }
    set highlightedShapeMemberPath(v) {
        this.i.vn = v;
    }
    /**
     * Gets or sets the effective x-axis for the current ScatterBase object.
    */
    get xAxis() {
        const r = this.i.ui;
        if (r == null) {
            return null;
        }
        if (!r.externalObject) {
            let e = IgrNumericXAxis._createFromInternal(r);
            if (e) {
                e._implementation = r;
            }
            r.externalObject = e;
        }
        return r.externalObject;
    }
    set xAxis(v) {
        if (v != null && this._stylingContainer && v._styling)
            v._styling(this._stylingContainer, this, this);
        v == null ? this.i.ui = null : this.i.ui = v.i;
    }
    /**
    * Gets or sets the name to use to resolve xAxis from markup.
    */
    get xAxisName() {
        return this._xAxisName;
    }
    set xAxisName(v) {
        this._xAxisName = v;
    }
    /**
     * Gets or sets the effective y-axis for the current ScatterBase object.
    */
    get yAxis() {
        const r = this.i.uk;
        if (r == null) {
            return null;
        }
        if (!r.externalObject) {
            let e = IgrNumericYAxis._createFromInternal(r);
            if (e) {
                e._implementation = r;
            }
            r.externalObject = e;
        }
        return r.externalObject;
    }
    set yAxis(v) {
        if (v != null && this._stylingContainer && v._styling)
            v._styling(this._stylingContainer, this, this);
        v == null ? this.i.uk = null : this.i.uk = v.i;
    }
    /**
    * Gets or sets the name to use to resolve yAxis from markup.
    */
    get yAxisName() {
        return this._yAxisName;
    }
    set yAxisName(v) {
        this._yAxisName = v;
    }
    /**
     * 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 shapeFilterResolution() {
        return this.i.vg;
    }
    set shapeFilterResolution(v) {
        this.i.vg = +v;
    }
    /**
     * Gets whether or not this series is a shape series
    */
    get isShape() {
        return this.i.fa;
    }
    /**
     * Overridden by derived series classes to indicate when marker-less display is preferred or not.
    */
    get isMarkerlessDisplayPreferred() {
        return this.i.ey;
    }
    bindAxes(axes) {
        super.bindAxes(axes);
        for (let i = 0; i < axes.length; i++) {
            if (this.xAxisName && this.xAxisName.length > 0 &&
                axes[i].name == this.xAxisName) {
                this.xAxis = axes[i];
            }
        }
        for (let i = 0; i < axes.length; i++) {
            if (this.yAxisName && this.yAxisName.length > 0 &&
                axes[i].name == this.yAxisName) {
                this.yAxis = axes[i];
            }
        }
    }
    findByName(name) {
        var baseResult = super.findByName(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;
    }
    _styling(container, component, parent) {
        super._styling(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;
    }
    getItemValue(item, memberPathName) {
        let iv = this.i.ju(item, memberPathName);
        return (iv);
    }
    getExactItemIndex(world) {
        let iv = this.i.hv(toPoint(world));
        return (iv);
    }
    getSeriesValuePosition(world, useInterpolation, skipUnknowns) {
        let iv = this.i.th(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.
    */
    getItem(world) {
        let iv = this.i.jr(toPoint(world));
        return (iv);
    }
    /**
     * Determine if object can be used as YAxis
    
    * @param axis  * The object to check
    */
    canUseAsYAxis(axis) {
        let iv = this.i.ux(axis);
        return (iv);
    }
    /**
     * Determine if object can be used as XAxis
    
    * @param axis  * The object to check
    */
    canUseAsXAxis(axis) {
        let iv = this.i.uw(axis);
        return (iv);
    }
    /**
     * Event raised when Assigning Shape Style. Note, if using this event, or highlighting, its best to avoid use of ShapeStyle/StyleShape/ShapeStyleSelector.
    */
    get assigningShapeStyle() {
        return this._assigningShapeStyle;
    }
    set assigningShapeStyle(ev) {
        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 = (o, e) => {
            let 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);
        ;
    }
    /**
     * Event raised when Assigning Shape Marker Style
    */
    get assigningShapeMarkerStyle() {
        return this._assigningShapeMarkerStyle;
    }
    set assigningShapeMarkerStyle(ev) {
        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 = (o, e) => {
            let 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);
        ;
    }
    /**
     * Raised when tile's image URI should be provided
    */
    get styleShape() {
        return this._styleShape;
    }
    set styleShape(ev) {
        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 = (o, e) => {
            let 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);
        ;
    }
}
