#pragma once #include "ServoGraph.h" #include "ServoCommo.h" enum DeviceStatus { ONLINE, // 在线 OFFLINE, // 离线 OCCUPIED // 有片(占用) }; struct RobotPositionMapping { SERVO::ROBOT_POSITION position; float percentage; float angle; int arm; // 0 表示 ARM1,1 表示 ARM2 }; // CPageGraph1 对话框 class CPageGraph1 : public CDialogEx { DECLARE_DYNAMIC(CPageGraph1) public: CPageGraph1(CWnd* pParent = nullptr); // 标准构造函数 virtual ~CPageGraph1(); public: std::string GetConfigPath(); void InitRxWindows(); void UpdateDeviceStatus(int id, DeviceStatus status); void UpdateRobotPosition(float percentage); void RotateRobot(float angleInDegrees); void BindEquipmentToGraph(); void MoveRobotToPosition(SERVO::ROBOT_POSITION position); POINT LoadArmOffset(const std::string& armName); void SaveArmOffset(const std::string& armName, const POINT& pt); private: IObserver* m_pObserver; CServoGraph* m_pGraph; BOOL m_bIsRobotMoving; COLORREF m_crBkgnd; HBRUSH m_hbrBkgnd; SERVO::ROBOT_POSITION m_lastRobotPosition; BOOL m_lastArmState[2]; POINT m_arm1Offset; // ARM1 从中心向左47, 向上33 POINT m_arm2Offset; // ARM2 从中心向右10, 向上33 // 对话框数据 #ifdef AFX_DESIGN_TIME enum { IDD = IDD_PAGE_GRAPH1 }; #endif protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 DECLARE_MESSAGE_MAP() public: virtual BOOL OnInitDialog(); afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); afx_msg void OnDestroy(); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnGraphItemClicked(NMHDR* pNMHDR, LRESULT* pResult); afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnTimer(UINT_PTR nIDEvent); };