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

//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright © 2000-2002. All Rights Reserved.
// Version 1.0 11/05/2000
// Last modification: 08/10/2003
// Project Intruder Position Indicator
// SUBSYSTEM: Polygon
// FILE: Polygon.h
// AUTHOR: Chizhevskiy Sergey
// OVERVIEW
// ~~~~~~~~
// Header file of class CPolygon
//----------------------------------------------------------------------------
#ifndef __POLYGON__H__INCLUDED__
#define __POLYGON__H__INCLUDED__
class CPolygon
{
public:
CPolygon(INT type);
CPolygon(HANDLE hFile);
~CPolygon();
CPolygon& operator = (const CPolygon& polygon);
LPPOINT operator[] (INT index);
public:
void SetVisible(BOOL fVisible);
BOOL Save(HANDLE hFile);
BOOL Load(HANDLE hFile);
void Draw(HDC hDC, POINT& center, const double& scale, double dZeroShift );
void Empty();
BOOL AddPoint(LPPOINT pPoint, const double& diff);
BOOL PtInPolygon(POINT &point) const;
HRGN GetSafeHrgn() const;
LPPOINT GetPoints() const;
INT GetCount() const;
INT GetType() const;
private:
LPPOINT m_pPoints;
LPPOINT m_pPointsDraw;
BOOL m_fVisible;
HRGN m_hRgn;
INT m_nCount;
INT m_Type;
};
inline
LPPOINT CPolygon::operator[] (INT index)
{
return m_nCount > index ? m_pPoints + index : NULL;
}
inline
LPPOINT CPolygon::GetPoints() const
{
return m_pPoints;
}
inline
INT CPolygon::GetCount() const
{
return m_nCount;
}
inline
INT CPolygon::GetType() const
{
return m_Type;
}
inline
BOOL CPolygon::PtInPolygon(POINT & point) const
{
return m_hRgn ? ::PtInRegion(m_hRgn, point.x, point.y) : FALSE;
}
inline
HRGN CPolygon::GetSafeHrgn() const
{
return m_hRgn;
}
class CPolygons
{
public:
CPolygons();
~CPolygons();
CPolygon* operator[](INT index);
void SetVisible(INT nType, BOOL fVisible);
void SetRayCount(INT nRays);
void ProduceHiddenZones(HDC hDC, POINT& center, double range,
const double& scale, double dZeroShift );
BOOL Delete(POINT& p);
void Draw(HDC hDC, POINT& center, const double& scale, double dZeroShift );
BOOL AddPolygon(CPolygon *pPolygon);
BOOL PtInPolygons(POINT &point, BOOL *pFlags) const;
BOOL Save(LPCTSTR pName);
BOOL Load(LPCTSTR pName);
void Empty();
INT GetCount() const;
private:
CRITICAL_SECTION cs; // 24/05/2001
CPolygon** m_pPolygons;
INT m_nCount;
INT m_nRayCount;
};
inline
CPolygon* CPolygons::operator[] (INT index)
{
return m_nCount > index ? m_pPolygons[index] : NULL;
}
inline
INT CPolygons::GetCount() const
{
return m_nCount;
}
inline
void CPolygons::SetRayCount(INT nRays)
{
m_nRayCount = nRays;
}
inline
void CPolygon::SetVisible(BOOL fVisible)
{
m_fVisible = fVisible;
}
#endif