
export const registerExtraShape = function (mxCellRenderer: any, mxCylinder: any, mxUtils: any) {
    //注册与
    function BoxAnd() {
        //@ts-ignore
        mxCylinder.call(this);
    }
    mxUtils.extend(BoxAnd, mxCylinder);
    // BoxCondition.prototype.extrude = 10;
    BoxAnd.prototype.redrawPath = function (path: any, x: number, y: number, w: number, h: number, isForeground: boolean) {
        const dy = this.extrude * this.scale;
        const dx = this.extrude * this.scale;
        if (isForeground) {
            path.moveTo(20, h / 2);
            path.lineTo(w - 20, h / 2);
            path.moveTo(w / 2, 20);
            path.lineTo(w / 2, w - 20);
            path.close();
            path.state.strokeWidth = 6
        }
        else {
            path.moveTo(0, h / 2);
            path.lineTo(w / 2, h);
            path.lineTo(w, h / 2);
            path.lineTo(w / 2, 0);
            path.close();
        }
    };
    mxCellRenderer.registerShape('and', BoxAnd);

    //注册或
    function BoxOR() {
        //@ts-ignore
        mxCylinder.call(this);
    }
    mxUtils.extend(BoxOR, mxCylinder);
    // BoxCondition.prototype.extrude = 10;
    BoxOR.prototype.redrawPath = function (path: any, x: number, y: number, w: number, h: number, isForeground: boolean) {
        const dy = this.extrude * this.scale;
        const dx = this.extrude * this.scale;
        if (isForeground) {
            path.ellipse(20, 20, w - 40, h - 40);
            path.state.strokeWidth = 6
        }
        else {
            path.moveTo(0, h / 2);
            path.lineTo(w / 2, h);
            path.lineTo(w, h / 2);
            path.lineTo(w / 2, 0);
            path.close();
        }
    };
    mxCellRenderer.registerShape('xor', BoxOR);

    //注册条件
    function BoxCondition() {
        //@ts-ignore
        mxCylinder.call(this);
    }
    mxUtils.extend(BoxCondition, mxCylinder);
    // BoxCondition.prototype.extrude = 10;
    BoxCondition.prototype.redrawPath = function (path: any, x: number, y: number, w: number, h: number, isForeground: boolean) {
        const dy = this.extrude * this.scale;
        const dx = this.extrude * this.scale;
        if (isForeground) {
            //暂时不处理
        }
        else {
            path.moveTo(0, h / 2);
            path.lineTo(w / 2, h);
            path.lineTo(w, h / 2);
            path.lineTo(w / 2, 0);
            path.close();
        }
    };
    mxCellRenderer.registerShape('condition', BoxCondition);


    //注册复杂条件
    function BoxComplexCondition() {
        //@ts-ignore
        mxCylinder.call(this);
    }
    mxUtils.extend(BoxComplexCondition, mxCylinder);
    // BoxCondition.prototype.extrude = 10;
    BoxComplexCondition.prototype.redrawPath = function (path: any, x: number, y: number, w: number, h: number, isForeground: boolean) {
        const dy = this.extrude * this.scale;
        const dx = this.extrude * this.scale;
        if (isForeground) {
            //暂时不处理
            path.state.strokeWidth = 6
            path.moveTo(10, w / 2);
            path.lineTo(w - 10, w / 2);
            path.moveTo(w / 2, 10);
            path.lineTo(w / 2, h - 10);
            path.moveTo(20, 20);
            path.lineTo(w - 20, h - 20);
            path.moveTo(20, 20);
            path.lineTo(w - 20, h - 20);
            path.moveTo(20, h - 20);
            path.lineTo(w - 20, 20);
        }
        else {
            path.moveTo(0, h / 2);
            path.lineTo(w / 2, h);
            path.lineTo(w, h / 2);
            path.lineTo(w / 2, 0);
            path.close();
        }
    };
    mxCellRenderer.registerShape('ccp', BoxComplexCondition);


    //注册子过程
    function BoxSub() {
        //@ts-ignore
        mxCylinder.call(this);
    }
    mxUtils.extend(BoxSub, mxCylinder);
    // BoxCondition.prototype.extrude = 10;
    BoxSub.prototype.redrawPath = function (path: any, x: number, y: number, w: number, h: number, isForeground: boolean) {
        const dy = this.extrude * this.scale;
        const dx = this.extrude * this.scale;
        if (isForeground) {
            //暂时不处理
            path.state.strokeWidth = 2
        }
        else {
            path.moveTo(0, 0);
            path.lineTo(w, 0);
            path.lineTo(w, h);
            path.lineTo(0, h);
            path.close();
            path.moveTo(20, 0);
            path.lineTo(20, h);
            path.moveTo(w - 20, 0);
            path.lineTo(w - 20, h);


        }
    };
    mxCellRenderer.registerShape('sunp', BoxSub);


    //注册子过程返回
    function BoxSubReturn() {
        //@ts-ignore
        mxCylinder.call(this);
    }
    mxUtils.extend(BoxSubReturn, mxCylinder);
    // BoxCondition.prototype.extrude = 10;
    BoxSubReturn.prototype.redrawPath = function (path: any, x: number, y: number, w: number, h: number, isForeground: boolean) {
        const dy = this.extrude * this.scale;
        const dx = this.extrude * this.scale;
        if (isForeground) {
            //暂时不处理
            path.ellipse(20, 5, w - 40, h - 10);
            path.state.strokeWidth = 2
        }
        else {
            path.moveTo(0, 0);
            path.lineTo(w, 0);
            path.lineTo(w, h);
            path.lineTo(0, h);
            path.close();
            path.moveTo(20, 0);
            path.lineTo(20, h);
            path.moveTo(w - 20, 0);
            path.lineTo(w - 20, h);


        }
    };
    mxCellRenderer.registerShape('sunpr', BoxSubReturn);

    //注册子过程返回
    function BoxEnd() {
        //@ts-ignore
        mxCylinder.call(this);
    }
    mxUtils.extend(BoxEnd, mxCylinder);
    // BoxCondition.prototype.extrude = 10;
    BoxEnd.prototype.redrawPath = function (path: any, x: number, y: number, w: number, h: number, isForeground: boolean) {
        const dy = this.extrude * this.scale;
        const dx = this.extrude * this.scale;
        if (isForeground) {
            //暂时不处理

        }
        else {
            path.moveTo(0, 0);
            path.lineTo(w, 0);
            path.lineTo(w, h);
            path.lineTo(0, h);
            path.close();
        }
    };
    mxCellRenderer.registerShape('end', BoxEnd);

    //注册空工艺
    function BoxNULL() {
        //@ts-ignore
        mxCylinder.call(this);
    }
    mxUtils.extend(BoxNULL, mxCylinder);
    BoxNULL.prototype.redrawPath = function (path: any, x: number, y: number, w: number, h: number, isForeground: boolean) {
        if (isForeground) {
            //暂时不处理
        }
        else {
            path.moveTo(0, 0);
            path.lineTo(w, 0);
            path.lineTo(w, h);
            path.lineTo(0, h);
            path.close();
        }
    };
    mxCellRenderer.registerShape('NULL', BoxNULL);

    //注册分配工艺
    function BoxAllot() {
        //@ts-ignore
        mxCylinder.call(this);
    }
    mxUtils.extend(BoxAllot, mxCylinder);
    BoxAllot.prototype.redrawPath = function (path: any, x: number, y: number, w: number, h: number, isForeground: boolean) {
        if (isForeground) {
            //暂时不处理
        }
        else {
            path.moveTo(0, 0);
            path.lineTo(w, 0);
            path.lineTo(w, h);
            path.lineTo(0, h);
            path.close();
        }
    };
    mxCellRenderer.registerShape('Allot', BoxAllot);


    //注册集线器
    function BoxHub() {
        //@ts-ignore
        mxCylinder.call(this);
    }
    mxUtils.extend(BoxHub, mxCylinder);
    // BoxCondition.prototype.extrude = 10;
    BoxHub.prototype.redrawPath = function (path: any, x: number, y: number, w: number, h: number, isForeground: boolean) {
        const dy = this.extrude * this.scale;
        const dx = this.extrude * this.scale;
        if (isForeground) {
            //暂时不处理

        }
        else {
            path.moveTo(0, 0);
            path.lineTo(w, 0);
            path.lineTo(w, h);
            path.lineTo(0, h);
            path.close();
        }
    };
    mxCellRenderer.registerShape('hub', BoxHub);

    //注册集线器
    function BoxBus() {
        //@ts-ignore
        mxCylinder.call(this);
    }
    mxUtils.extend(BoxBus, mxCylinder);
    // BoxCondition.prototype.extrude = 10;
    BoxBus.prototype.redrawPath = function (path: any, x: number, y: number, w: number, h: number, isForeground: boolean) {
        const dy = this.extrude * this.scale;
        const dx = this.extrude * this.scale;
        if (isForeground) {
            //暂时不处理

        }
        else {
            path.moveTo(0, 0);
            path.lineTo(5, 0);
            path.moveTo(w - 5, 0);
            path.lineTo(w, 0);
            path.lineTo(w, 5);
            path.moveTo(w, h - 5);
            path.lineTo(w, h);
            path.lineTo(w - 5, h);
            path.moveTo(5, h);
            path.lineTo(0, h);
            path.moveTo(0, h - 5);
            path.lineTo(0, h);
            path.moveTo(0, 5);
            path.lineTo(0, 0);
            path.close();
        }
    };
    mxCellRenderer.registerShape('outline', BoxBus);

}
