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.

142 lines
2.8 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 11/05/2000
  5. // Last modification: 08/10/2003
  6. // Project Intruder Position Indicator
  7. // SUBSYSTEM: Polygon
  8. // FILE: Polygon.h
  9. // AUTHOR: Chizhevskiy Sergey
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of class CPolygon
  13. //----------------------------------------------------------------------------
  14. #ifndef __POLYGON__H__INCLUDED__
  15. #define __POLYGON__H__INCLUDED__
  16. class CPolygon
  17. {
  18. public:
  19. CPolygon(INT type);
  20. CPolygon(HANDLE hFile);
  21. ~CPolygon();
  22. CPolygon& operator = (const CPolygon& polygon);
  23. LPPOINT operator[] (INT index);
  24. public:
  25. void SetVisible(BOOL fVisible);
  26. BOOL Save(HANDLE hFile);
  27. BOOL Load(HANDLE hFile);
  28. void Draw(HDC hDC, POINT& center, const double& scale, double dZeroShift );
  29. void Empty();
  30. BOOL AddPoint(LPPOINT pPoint, const double& diff);
  31. BOOL PtInPolygon(POINT &point) const;
  32. HRGN GetSafeHrgn() const;
  33. LPPOINT GetPoints() const;
  34. INT GetCount() const;
  35. INT GetType() const;
  36. private:
  37. LPPOINT m_pPoints;
  38. LPPOINT m_pPointsDraw;
  39. BOOL m_fVisible;
  40. HRGN m_hRgn;
  41. INT m_nCount;
  42. INT m_Type;
  43. };
  44. inline
  45. LPPOINT CPolygon::operator[] (INT index)
  46. {
  47. return m_nCount > index ? m_pPoints + index : NULL;
  48. }
  49. inline
  50. LPPOINT CPolygon::GetPoints() const
  51. {
  52. return m_pPoints;
  53. }
  54. inline
  55. INT CPolygon::GetCount() const
  56. {
  57. return m_nCount;
  58. }
  59. inline
  60. INT CPolygon::GetType() const
  61. {
  62. return m_Type;
  63. }
  64. inline
  65. BOOL CPolygon::PtInPolygon(POINT & point) const
  66. {
  67. return m_hRgn ? ::PtInRegion(m_hRgn, point.x, point.y) : FALSE;
  68. }
  69. inline
  70. HRGN CPolygon::GetSafeHrgn() const
  71. {
  72. return m_hRgn;
  73. }
  74. class CPolygons
  75. {
  76. public:
  77. CPolygons();
  78. ~CPolygons();
  79. CPolygon* operator[](INT index);
  80. void SetVisible(INT nType, BOOL fVisible);
  81. void SetRayCount(INT nRays);
  82. void ProduceHiddenZones(HDC hDC, POINT& center, double range,
  83. const double& scale, double dZeroShift );
  84. BOOL Delete(POINT& p);
  85. void Draw(HDC hDC, POINT& center, const double& scale, double dZeroShift );
  86. BOOL AddPolygon(CPolygon *pPolygon);
  87. BOOL PtInPolygons(POINT &point, BOOL *pFlags) const;
  88. BOOL Save(LPCTSTR pName);
  89. BOOL Load(LPCTSTR pName);
  90. void Empty();
  91. INT GetCount() const;
  92. private:
  93. CRITICAL_SECTION cs; // 24/05/2001
  94. CPolygon** m_pPolygons;
  95. INT m_nCount;
  96. INT m_nRayCount;
  97. };
  98. inline
  99. CPolygon* CPolygons::operator[] (INT index)
  100. {
  101. return m_nCount > index ? m_pPolygons[index] : NULL;
  102. }
  103. inline
  104. INT CPolygons::GetCount() const
  105. {
  106. return m_nCount;
  107. }
  108. inline
  109. void CPolygons::SetRayCount(INT nRays)
  110. {
  111. m_nRayCount = nRays;
  112. }
  113. inline
  114. void CPolygon::SetVisible(BOOL fVisible)
  115. {
  116. m_fVisible = fVisible;
  117. }
  118. #endif