#pragma once

#include "dt.h"
#include <map>

#include "CManageDB.h"

#ifdef CMATRIX_EXPORTS
#define CMATRIX_DLL_API __declspec(dllexport)
#else
#define CMATRIX_DLL_API //__declspec(dllimport)
#endif


using namespace ns_db;

namespace ns_mat
{
#define MAT_COMM_PI 3.1415926

#define NONE_POINT_INDEX 0
#define FIRST_POINT_INDEX 1

	enum MATRIX_SEARCH_DIR {
		DIR_S = 0X0,/*������*/
		DIR_Z = 0X1,/*֮����*/
	};

	enum PICK_DIE_STATUS {
		DIE_EXIST,/*ԭ����*/
		PICK_ING,/*����ȡ*/
		NO_EXIST,/*��ȡ��*/
		EDGE_DIE,
		SKIP_DIE,
		//NO_EXIST,/*�����ĵ�*/
	};

	class CMATRIX_DLL_API CMatrixCommon
	{
	public:
		//��������ĽǶ�
		static double TwoPointCalculateAngle(XY_DOUBLE_STRUCT p, XY_DOUBLE_STRUCT ori);
		//����ij����תһ���ǶȺ��λ��
		static void CalRotationPoint(XY_DOUBLE_STRUCT prePoint, double angle, XY_DOUBLE_STRUCT& pointResult);

		static bool IsNoBondPoint(vector<XY_LONG_STRUCT> vecNoBondPt, UINT iRow, UINT iCol);
		static XY_DOUBLE_STRUCT CalculatePosition(PROGRAM_DIE_MATRIX_STRUCT stMatrix, UINT iRow, UINT iCol);
		static XY_DOUBLE_STRUCT CalculatePosition(PROGRAM_WAFFLE_MATRIX_STRUCT stMatrix, UINT iRow, UINT iCol);

		static XY_DOUBLE_STRUCT CalculatePosition(PROGRAM_HEAD_TABLE_MATRIX_STRUCT stMatrix, UINT iRow, UINT iCol);

		static XY_DOUBLE_STRUCT CalculatePosition(PROGRAM_POINT_MATRIX_STRUCT stMatrix, UINT iRow, UINT iCol);
		static XY_DOUBLE_STRUCT CalculatePosition(PROGRAM_BOND_MATRIX_STRUCT stMatrix, UINT iRow, UINT iCol);

		static XY_DOUBLE_STRUCT CalculatePosition(OneDimMatrixInfo stMatrix, int iRow, int iCol);
	};

}