import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { IgrNumericXAxis } from "./igr-numeric-x-axis";
import { IgrNumericYAxis } from "./igr-numeric-y-axis";
import { IgrTriangulationStatusEventArgs } from "igniteui-react-core";
import { IgrSeries } from "./igr-series";
/**
 * Base class for series which triangulate XY data prior to rendering.
*/
export class IgrScatterTriangulationSeries extends IgrSeries {
    /**
                                 * @hidden
                                 */
    get i() {
        return this._implementation;
    }
    constructor(props) {
        super(props);
        this._xAxisName = null;
        this._yAxisName = null;
        this._triangulationStatusChanged = null;
        this._triangulationStatusChanged_wrapped = null;
    }
    /**
     * The name of the property from which to extract the X-coordinate for each item in the ItemsSource.
    */
    get xMemberPath() {
        return this.i.u3;
    }
    set xMemberPath(v) {
        this.i.u3 = v;
    }
    /**
     * The name of the property from which to extract the Y-coordinate for each item in the ItemsSource.
    */
    get yMemberPath() {
        return this.i.vb;
    }
    set yMemberPath(v) {
        this.i.vb = v;
    }
    /**
     * The X-Axis for this series.
    */
    get xAxis() {
        const r = this.i.t1;
        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.t1 = null : this.i.t1 = 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;
    }
    /**
     * The Y-Axis for this series.
    */
    get yAxis() {
        const r = this.i.t2;
        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.t2 = null : this.i.t2 = 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 source of triangulation data.
     * This property is optional.  If it is left as null, the triangulation will be created based on the items in the ItemsSource.  Triangulation is a demanding operation, so the runtime performance will be better when specifying a TriangulationSource, especially when a large number of data items are present.
    */
    get trianglesSource() {
        return this.i.trianglesSource;
    }
    set trianglesSource(v) {
        this.i.trianglesSource = v;
    }
    /**
     * The name of the property of the TrianglesSource items which, for each triangle, contains the index of the first vertex point in the ItemsSource.
    */
    get triangleVertexMemberPath1() {
        return this.i.ur;
    }
    set triangleVertexMemberPath1(v) {
        this.i.ur = v;
    }
    /**
     * The name of the property of the TrianglesSource items which, for each triangle, contains the index of the second vertex point in the ItemsSource.
    */
    get triangleVertexMemberPath2() {
        return this.i.ut;
    }
    set triangleVertexMemberPath2(v) {
        this.i.ut = v;
    }
    /**
     * The name of the property of the TrianglesSource items which, for each triangle, contains the index of the third vertex point in the ItemsSource.
    */
    get triangleVertexMemberPath3() {
        return this.i.uv;
    }
    set triangleVertexMemberPath3(v) {
        this.i.uv = 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;
    }
    /**
     * Gets or sets the label displayed before series X value in the Data Legend.
    */
    get xMemberAsLegendLabel() {
        return this.i.uz;
    }
    set xMemberAsLegendLabel(v) {
        this.i.uz = v;
    }
    /**
     * Gets or sets the label displayed before series Y value in the Data Legend.
    */
    get yMemberAsLegendLabel() {
        return this.i.u7;
    }
    set yMemberAsLegendLabel(v) {
        this.i.u7 = v;
    }
    /**
     * Gets or sets the unit after displayed after series X value in the Data Legend.
    */
    get xMemberAsLegendUnit() {
        return this.i.u1;
    }
    set xMemberAsLegendUnit(v) {
        this.i.u1 = v;
    }
    /**
     * Gets or sets the unit after displayed after series Y value in the Data Legend.
    */
    get yMemberAsLegendUnit() {
        return this.i.u9;
    }
    set yMemberAsLegendUnit(v) {
        this.i.u9 = v;
    }
    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);
    }
    /**
     * Determine if object can be used as YAxis
    
    * @param axis  * The object to check
    */
    canUseAsYAxis(axis) {
        let iv = this.i.uj(axis);
        return (iv);
    }
    /**
     * Determine if object can be used as XAxis
    
    * @param axis  * The object to check
    */
    canUseAsXAxis(axis) {
        let iv = this.i.ui(axis);
        return (iv);
    }
    /**
     * Raised when the status of an ongoing Triangulation has changed.
    */
    get triangulationStatusChanged() {
        return this._triangulationStatusChanged;
    }
    set triangulationStatusChanged(ev) {
        if (this._triangulationStatusChanged_wrapped !== null) {
            this.i.triangulationStatusChanged = delegateRemove(this.i.triangulationStatusChanged, this._triangulationStatusChanged_wrapped);
            this._triangulationStatusChanged_wrapped = null;
            this._triangulationStatusChanged = null;
        }
        this._triangulationStatusChanged = ev;
        this._triangulationStatusChanged_wrapped = (o, e) => {
            let outerArgs = new IgrTriangulationStatusEventArgs();
            outerArgs._provideImplementation(e);
            if (this.beforeTriangulationStatusChanged) {
                this.beforeTriangulationStatusChanged(this, outerArgs);
            }
            if (this._triangulationStatusChanged) {
                this._triangulationStatusChanged(this, outerArgs);
            }
        };
        this.i.triangulationStatusChanged = delegateCombine(this.i.triangulationStatusChanged, this._triangulationStatusChanged_wrapped);
        ;
    }
}
