Old fashion design for PC-104
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

165 lines
4.5 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: Sensor.h
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of Sensor.h
  13. //----------------------------------------------------------------------------
  14. // Sensor.h: interface for the CSensor class.
  15. //
  16. //////////////////////////////////////////////////////////////////////
  17. #if !defined(AFX_SENSOR_H__9B1BD4F7_71EC_11D4_A1EF_0010B55CB330__INCLUDED_)
  18. #define AFX_SENSOR_H__9B1BD4F7_71EC_11D4_A1EF_0010B55CB330__INCLUDED_
  19. #if _MSC_VER > 1000
  20. #pragma once
  21. #endif // _MSC_VER > 1000
  22. #include "Auxlib.h"
  23. #include "Visual.h"
  24. #include "EventQueue.h"
  25. #include "VideoCamera.h" // Added by ClassView
  26. #include "Transform.h" // Added by ClassView
  27. #include "DirectInputSet.h" // Added by ClassView
  28. #include "DirectOutputSet.h" // Added by ClassView
  29. class CZone;
  30. class CSensorArray;
  31. struct PATROL;
  32. class CPropertySensorWnd;
  33. class CSensor :
  34. public CVisual
  35. {
  36. public:
  37. CSensor();
  38. ~CSensor();
  39. public:
  40. virtual BOOL Paint( CDC *pDC, CRect& viewRect, CSize& mapSize, SDPOINT& mapShift, double mapScale, BOOL bInverse, BOOL bBigSize, CRect *UpdateRect = NULL );
  41. public:
  42. void SetSensorArray( CSensorArray *pSensorArray );
  43. void SetAddress( int iAddress ) { m_iAddress = iAddress; }
  44. int GetAddress( ) { return m_iAddress; }
  45. void SetArrayIndex( int nIndex ) { m_nIndex = nIndex; }
  46. int GetArrayIndex( ) { return m_nIndex; }
  47. void SetSocket( int nSocket ) { m_nSocket = nSocket; }
  48. int GetSocket() { return m_nSocket; }
  49. void SetZoneIndex( int nZone ) { m_nZone = nZone; }
  50. int GetZoneIndex() { return m_nZone; }
  51. void SetZone( CZone *pZone ) { m_pZone = pZone; }
  52. CZone *GetZone() { return m_pZone; }
  53. void SetPatrol( BOOL bPatrol ) { m_bPatrol = bPatrol; }
  54. BOOL GetPatrol( void ) { return m_bPatrol; }
  55. void SetImageCount( int nImageCount ) { m_nImageCount = nImageCount; }
  56. int GetImageCount() { return m_nImageCount; }
  57. virtual void SetState( int nState );
  58. virtual void Enable( BOOL bEnable );
  59. virtual void Reset();
  60. virtual void CheckCommand();
  61. virtual void SetSensorPropertyWnd( CPropertySensorWnd *pWnd );
  62. virtual void UpdateSensorProperty();
  63. // relation with camera for video capturing
  64. CVideoCamera *GetVideoCamera() { return m_pVideoCamera; }
  65. void SetVideoCamera( CVideoCamera *pCamera ) { m_pVideoCamera = pCamera; }
  66. CTransform *GetTransform( int nIndex ) { return ( nIndex < 2 ) ? m_pTransform[nIndex] : NULL; }
  67. // IMPOTENT: transform object automatically will be deleted in ~CSensor
  68. void SetTransform( BOOL bRemoteCamera, double dPanShift, double *pTiltTable, CTransform *pTransformMaster, CTransform *pTransformSlave )
  69. {
  70. m_pTransform[0] = pTransformMaster;
  71. m_pTransform[1] = pTransformSlave;
  72. m_bRemoteCamera = bRemoteCamera;
  73. m_dPanShift = dPanShift;
  74. for( int i = 0; i < 10; i++ )
  75. m_pTiltTable[i] = pTiltTable[i];
  76. }
  77. CDirectInputSet& GetCommandInputSet() { return m_CommandInputSet; }
  78. CDirectOutputSet& GetEventOutputSet() { return m_EventOutputSet; }
  79. BOOL GetWaveSound( LPCTSTR *pFile, int& maxCount );
  80. protected:
  81. virtual void OnCommand( INT nCommand, BOOL bOn );
  82. void OnEvent( INT nCommand, BOOL bOn );
  83. protected:
  84. void RedrawSensor();
  85. INT m_iAddress;
  86. DWORD m_dwTime;
  87. INT m_nIndex;
  88. INT m_nSocket;
  89. INT m_nZone;
  90. CZone *m_pZone;
  91. BOOL m_bPatrol;
  92. CSensorArray *m_pSensorArray;
  93. // for video capturing
  94. CVideoCamera *m_pVideoCamera;
  95. private:
  96. BOOL m_bRemoteCamera;
  97. double m_dPanShift;
  98. double m_pTiltTable[10];
  99. CTransform *m_pTransform[2];
  100. public:
  101. // for update transformation from calibration program
  102. int m_nTemplateType;
  103. int m_nTemplateIndex;
  104. public:
  105. INT GetAddressCCC() { return m_nAddressCCC; }
  106. void SetAddressCCC( INT nAddress ) { m_nAddressCCC = nAddress; }
  107. private:
  108. INT m_nAddressCCC;
  109. // for sound
  110. public:
  111. double GetRangeTilt( double dRange );
  112. bool CameraTransform( BOOL nDevice, double angle, double range, double *pPan, double *pTilt, double *pZoom );
  113. public:
  114. CLgArray<CString>& GetCalibrationNameArray() { return m_arrCalibrationName; }
  115. private:
  116. CLgArray<CString> m_arrCalibrationName;
  117. private:
  118. CPropertySensorWnd *m_pPropertySensorWnd;
  119. private:
  120. CDirectInputSet m_CommandInputSet;
  121. CDirectOutputSet m_EventOutputSet;
  122. private:
  123. INT m_nImageCount;
  124. };
  125. #endif