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.
92 lines
1.9 KiB
92 lines
1.9 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright Š 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 25/11/2001
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: AreaSensorWnd.cpp
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file of AreaSensorWnd.cpp
|
|
//----------------------------------------------------------------------------
|
|
#include "stdafx.h"
|
|
#include "chicago.h"
|
|
#include "AreaSensorWnd.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
BEGIN_MESSAGE_MAP(CAreaSensorWnd, CAreaWnd )
|
|
//{{AFX_MSG_MAP(CAreaSensorWnd)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
CAreaSensorWnd::CAreaSensorWnd()
|
|
{
|
|
m_pSensorArray = NULL;
|
|
m_pActiveSensor = NULL;
|
|
m_bOddUpdate = FALSE;
|
|
}
|
|
|
|
CAreaSensorWnd::~CAreaSensorWnd()
|
|
{
|
|
|
|
}
|
|
|
|
BOOL CAreaSensorWnd::SetActiveSensor( CSensor *pActiveSensor )
|
|
{
|
|
if( pActiveSensor != m_pActiveSensor )
|
|
{
|
|
m_pActiveSensor = pActiveSensor;
|
|
|
|
InvalidateRect( NULL );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
void CAreaSensorWnd::UpdateInfo( BOOL bOdd )
|
|
{
|
|
m_bOddUpdate = bOdd;
|
|
if( GetSafeHwnd() )
|
|
{
|
|
CClientDC dc( this );
|
|
OnDrawTimer( &dc );
|
|
}
|
|
}
|
|
|
|
void CAreaSensorWnd::OnDraw(CDC *pDC)
|
|
{
|
|
CAreaWnd::OnDraw( pDC );
|
|
|
|
OnDrawTimer( pDC );
|
|
}
|
|
|
|
void CAreaSensorWnd::OnDrawTimer( CDC *pDC )
|
|
{
|
|
for( int i = 0; i < m_pSensorArray->GetSensorCount(); i++ )
|
|
{
|
|
CSensor *pSensor = m_pSensorArray->GetSensor( i );
|
|
|
|
ASSERT( pSensor );
|
|
|
|
SDPOINT dPoint = pSensor->GetPosition();
|
|
CLgDPoint dp( dPoint.x, dPoint.y );
|
|
CPoint p = AreaToWindow( &dp );
|
|
|
|
CRect rect;
|
|
if( pSensor == m_pActiveSensor && !m_bOddUpdate )
|
|
rect.SetRect( p.x - 4, p.y - 4, p.x + 4, p.y + 4 );
|
|
else
|
|
rect.SetRect( p.x - 2, p.y - 2, p.x + 2, p.y + 2 );
|
|
|
|
pDC->FillSolidRect( &rect, pSensor->GetStateColor( m_bOddUpdate ) );
|
|
}
|
|
}
|