CruiseRoute.cpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. // CruiseRoute.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "StoneU_HC_OCX.h"
  5. #include "CruiseRoute.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CCruiseRoute dialog
  13. CCruiseRoute::CCruiseRoute(CWnd* pParent /*=NULL*/)
  14. : CDialog(CCruiseRoute::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CCruiseRoute)
  17. m_Preset = 0;
  18. m_Dwell = 0;
  19. m_Speed = 0;
  20. //}}AFX_DATA_INIT
  21. }
  22. void CCruiseRoute::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(CCruiseRoute)
  26. DDX_Control(pDX, IDC_COMBOCruiseRoute, m_Route);
  27. DDX_Control(pDX, IDC_COMBOCRUISEPOINT, m_Point);
  28. DDX_Text(pDX, IDC_EDIT1, m_Preset);
  29. DDX_Text(pDX, IDC_EDIT2, m_Dwell);
  30. DDX_Text(pDX, IDC_EDIT3, m_Speed);
  31. //}}AFX_DATA_MAP
  32. }
  33. BEGIN_MESSAGE_MAP(CCruiseRoute, CDialog)
  34. //{{AFX_MSG_MAP(CCruiseRoute)
  35. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  36. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  37. ON_CBN_SELCHANGE(IDC_COMBOCRUISEPOINT, OnSelchangeCombocruisepoint)
  38. //}}AFX_MSG_MAP
  39. END_MESSAGE_MAP()
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CCruiseRoute message handlers
  42. void CCruiseRoute::OnOK()
  43. {
  44. // TODO: Add extra validation here
  45. //CDialog::OnOK();
  46. }
  47. void CCruiseRoute::OnCancel()
  48. {
  49. // TODO: Add extra cleanup here
  50. //CDialog::OnCancel();
  51. }
  52. void CCruiseRoute::OnButton1()
  53. {
  54. // TODO: Add your control notification handler code here
  55. CDialog::OnOK();
  56. }
  57. BOOL CCruiseRoute::OnInitDialog()
  58. {
  59. CDialog::OnInitDialog();
  60. UpdateData(TRUE);
  61. // TODO: Add extra initialization here
  62. m_Sel = 0;
  63. m_Point.SetCurSel(m_Sel);
  64. m_Route.SetCurSel(0);
  65. if (!NET_DVR_GetPTZCruise(m_lServerID,1,m_Route.GetCurSel()+1, &CruiseRet))
  66. {
  67. CString sTemp;
  68. sTemp.Format("ERROR: NET_DVR_GetPTZCruise = %d \n", NET_DVR_GetLastError());
  69. MessageBox(sTemp, "ÎÂܰÌáʾ", MB_ICONINFORMATION);
  70. }
  71. else
  72. {
  73. m_Preset = CruiseRet.struCruisePoint[m_Sel].PresetNum;
  74. m_Dwell = CruiseRet.struCruisePoint[m_Sel].Dwell;
  75. m_Speed = CruiseRet.struCruisePoint[m_Sel].Speed;
  76. }
  77. UpdateData(FALSE);
  78. return TRUE; // return TRUE unless you set the focus to a control
  79. // EXCEPTION: OCX Property Pages should return FALSE
  80. }
  81. void CCruiseRoute::OnButton2()
  82. {
  83. // TODO: Add your control notification handler code here
  84. m_Sel = 0;
  85. UpdateData(TRUE);
  86. if (!NET_DVR_GetPTZCruise(m_lServerID,1,m_Route.GetCurSel()+1, &CruiseRet))
  87. {
  88. CString sTemp;
  89. sTemp.Format("ERROR: NET_DVR_GetPTZCruise = %d \n", NET_DVR_GetLastError());
  90. MessageBox(sTemp, "ÎÂܰÌáʾ", MB_ICONINFORMATION);
  91. m_Point.SetCurSel(0);
  92. m_Preset = 0;
  93. m_Dwell = 0;
  94. m_Speed = 0;
  95. }
  96. else
  97. {
  98. m_Point.SetCurSel(m_Sel);
  99. m_Preset = CruiseRet.struCruisePoint[m_Sel].PresetNum;
  100. m_Dwell = CruiseRet.struCruisePoint[m_Sel].Dwell;
  101. m_Speed = CruiseRet.struCruisePoint[m_Sel].Speed;
  102. }
  103. UpdateData(FALSE);
  104. }
  105. void CCruiseRoute::OnSelchangeCombocruisepoint()
  106. {
  107. // TODO: Add your control notification handler code here
  108. UpdateData(TRUE);
  109. m_Sel = m_Point.GetCurSel()+1;
  110. m_Preset = CruiseRet.struCruisePoint[m_Sel].PresetNum;
  111. m_Dwell = CruiseRet.struCruisePoint[m_Sel].Dwell;
  112. m_Speed = CruiseRet.struCruisePoint[m_Sel].Speed;
  113. UpdateData(FALSE);
  114. }