
//轮廓数据
export interface IContourData
{
    // pts: Vector2[];	//点集(二维向量(x,y))
    buls: number[];	//凸度(0直线段 >0逆时针方向 <0顺时针方向)
}

//偏心轮类型
// 左右侧板：Font朝向柜内，Back朝向柜外
// 顶底板：Font朝向柜外，Back两面朝下，Inside朝向柜内
export enum FaceDirection
{
    Front = 0,	//正面
    Back = 1,		//反面
    Inside = 2	//侧面
}

//造型数据
export interface IOriginModelingData
{
    outline: IContourData,				//轮郭
    holes: IContourData[];				//孔轮廓
    thickness?: number;						//厚度
    dir?: FaceDirection | number;	//方向
    knifeRadius?: number;					//刀半径
    addLen?: number;							//槽加长
    addWidth?: number;						//槽加宽
    addDepth?: number;						//槽加深
}

export abstract class BaseModel
{
    protected get props()
    {
        return [];
    }
    ToArray()
    {
        let reuslt = [];
        for (const key of this.props)
        {
            reuslt.push(this[key]);
        }
        return reuslt;
    }
}

//CAD板件点属性
export class CadBlockPoint extends BaseModel
{
    PointID: number;		//id
    PointX: number;			//x
    PointY: number;			//y
    Curve: number;			//曲线
    SealSize: number;		//封边尺寸
}

//CAD板件孔属性
export class CadBlockHoles extends BaseModel
{
    HoleID: number;			//孔ID
    HoleType: HoleType;	//孔类型(0大孔, 10小孔, 20木削, 21木削大孔, 30层板钉, 40通孔, 50连接杆, -10造型孔)
    Face: FaceType;			//孔面类型(0正面, 1反面, 2侧面)
    PointX: number;			//x
    PointY: number;			//y
    PointZ: number;			//z
    Radius: number;			//半径
    Depth: number;			//深度
    EndPoint: string;		//末端点
    PointX2: number;		//x2
    PointY2: number;		//y2
    Angle?: number;			//角度
}
export enum HoleType { 大孔 = 0, 小孔 = 10, 木削 = 20, 木削大孔 = 21, 层板钉 = 30, 通孔 = 40, 连接杆 = 50, 造型孔 = -10 }
export enum FaceType { 正面 = 0, 反面 = 1, 侧面 = 2 }

//CAD板件模块
export class CadBlockModel extends BaseModel
{
    ModelID: number;											//模块ID
    LineID: number;												//纹路ID
    Face: FaceType;												//板面类型(0正面, 1反面, 2侧面)
    KnifeName: string;										//刀具名称
    KnifeRadius: number;									//刀半径
    Depth: number;												//深度
    PointList: CadBlockModelPoint[];			//点列表
    OffSetList: ModelOffSetData[];				//偏移量列表
    OriginModeling: IOriginModelingData;	//造型数据

}

//模块偏移数据
export class ModelOffSetData extends BaseModel
{
    Name: string;			//名称
    Face: FaceType;		//面向类型(0正面, 1反面, 2侧面)
    Value: number;		//值
    Radius: number;		//半径
    Deep: number;			//深度
    Angle: number;		//角度
}

//CAD板件模块点
export class CadBlockModelPoint extends BaseModel
{
    LineID: number;		//纹路ID
    PointID: number;	//点ID
    PointX: number;		//x
    PointY: number;		//y
    Radius: number;		//半径
    Depth: number;		//深度
    Curve: number;		//曲线


}

//基准位置
export class BasePosition extends BaseModel
{
    BasePoint: string;	//基准点
    XVec: string;				//x矢量坐标
    YVec: string;				//y矢量坐标
    ZVec: string;				//z矢量坐标

}

//CAD板件信息
export class CadBlockInfo
{
    PointDetail: CadBlockPoint[];			//点明细
    HoleDetail: CadBlockHoles[];			//孔明细
    ModelDetail: CadBlockModel[];			//模块明细
    OrgPointDetail: CadBlockPoint[];	//原始点明细
    SideModelDetail: CadBlockModel[];	//侧面模块明细
    SideHoleDetail: CadBlockHoles[];	//侧面孔明细
}
