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.

73 lines
1.8 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: LgUISiteSensor.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of LgUISiteSensor.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "LgUISiteSensor.h"
  16. #include "LgUISiteCamera.h"
  17. #include "LgUISiteSensorWnd.h"
  18. #include "LgUISiteTroubleWnd.h"
  19. #include "LgUISiteEngine.h"
  20. #include "..\UICamera\LgUICameraVideoWnd.h"
  21. CLgUISiteSensor::CLgUISiteSensor( HAL_OBJECT_ID nID ) :
  22. CLgHALSensor( nID )
  23. {
  24. m_Position.x = (rand() % 100) / 100.0;
  25. m_Position.y = (rand() % 100) / 100.0;
  26. }
  27. CLgUISiteSensor::~CLgUISiteSensor()
  28. {
  29. CLgLink<CLgUISiteSensor,CLgUISiteEngine>::Unlink();
  30. }
  31. void CLgUISiteSensor::OnUIMapDraw( CLgUIMapObjectWnd *pMap, CDC *pDC, BOOL bActive, BOOL bOddUpdate )
  32. {
  33. CLgDPoint dp( m_Position.x, m_Position.y );
  34. CRect r;
  35. pMap->GetClientRect( &r );
  36. // draw sensor representation
  37. CPoint p = pMap->AreaToWindow( &dp );
  38. CRect rect;
  39. if( bActive && !bOddUpdate ) rect.SetRect( p.x - 2, p.y - 2, p.x + 2, p.y + 2 );
  40. else rect.SetRect( p.x - 1, p.y - 1, p.x + 1, p.y + 1 );
  41. pDC->FillSolidRect( &rect, RGB(0,0,255) );
  42. }
  43. void CLgUISiteSensor::OnUIMapDrawBackground( CLgUIMapObjectWnd *pMap, CDC *pDC )
  44. {
  45. }
  46. BOOL CLgUISiteSensor::OnUIMapHitTest( CLgUIMapObjectWnd *pMap, CLgDRect *pRect )
  47. {
  48. if( !pRect->PtInRect( m_Position ) )
  49. return FALSE;
  50. CLgUISiteEngine *pEngine = *this;
  51. if( !pEngine )
  52. {
  53. // critical error!
  54. ASSERT( NULL );
  55. return TRUE;
  56. }
  57. // try to activate sensor
  58. pEngine->OnActivateSensor( this );
  59. return TRUE;
  60. }