OneDimMatrix.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #include "CMatrixCommon.h"
  3. //一维矩阵:矩阵起点由外部保存,矩阵中保存的位置是相对于起点的位置
  4. //
  5. namespace ns_mat
  6. {
  7. struct MatrixPointInfo
  8. {
  9. int nDieRow = 0; //点在矩阵中所在行
  10. int nDieCol = 0; //点在矩阵中所在列
  11. int iDieIndex = 0; //当前Point在pcb中的序号
  12. bool bDisable = 0; //该点是否可用
  13. XY_DOUBLE_STRUCT stPosition{ 0,0 }; //程序设置的位置,相对于左上角的位置
  14. };
  15. class __declspec(dllexport) OneDimMatrix
  16. {
  17. public:
  18. OneDimMatrix();
  19. ~OneDimMatrix();
  20. LONG LoadMatrix(int matriId, MATRIX_SEARCH_DIR dir);
  21. LONG GetPointInfo(int index, MatrixPointInfo& pointInfo);
  22. LONG GetPointInfo(int row, int col, MatrixPointInfo& pointInfo);
  23. LONG GetPointPosition(int index, XY_DOUBLE_STRUCT& position);
  24. LONG GetPointPosition(int row, int col, XY_DOUBLE_STRUCT& pointInfo);
  25. int GetAmount() { return m_nAmount; };//获取总数
  26. private:
  27. void Sort_Z();
  28. void Sort_S();
  29. private:
  30. OneDimMatrixInfo m_stMatrixInfo;//矩阵数据
  31. std::map<int, MatrixPointInfo> m_mapMatrixInfo; //每个矩阵点对应的信息
  32. CProduct* m_pCProduct = nullptr; //产品数据库
  33. static std::mutex m_MatrixMutex;
  34. bool bIsInitSuccess = false;
  35. int m_nMartixID = 1;
  36. int m_nAmount = 0;
  37. };
  38. }