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.
162 lines
4.1 KiB
162 lines
4.1 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 08/10/2003
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: LgUIMapObjectWnd.cpp
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file of LgUIMapObjectWnd.cpp
|
|
//----------------------------------------------------------------------------
|
|
#include "stdafx.h"
|
|
#include "..\Version.h"
|
|
#include "LgUIMapObjectWnd.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
BEGIN_MESSAGE_MAP(CLgUIMapObjectWnd, CLgUIMapWnd )
|
|
//{{AFX_MSG_MAP(CLgUIMapObjectWnd)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
CLgUIMapObjectWnd::CLgUIMapObjectWnd()
|
|
{
|
|
m_pActiveObject = NULL;
|
|
m_bOddUpdate = FALSE;
|
|
|
|
// log info
|
|
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, "CLgUIMapObjectWnd::CLgUIMapObjectWnd" );
|
|
}
|
|
|
|
CLgUIMapObjectWnd::~CLgUIMapObjectWnd()
|
|
{
|
|
// unlink all devices
|
|
CLgLinkP<CLgUIMapObjectWnd,CLgUIMapObject>::Unlink();
|
|
|
|
// log info
|
|
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, "CLgUIMapObjectWnd::~CLgUIMapObjectWnd" );
|
|
}
|
|
|
|
BOOL CLgUIMapObjectWnd::SetActiveObject( CLgUIMapObject *pActiveObject )
|
|
{
|
|
LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CLgUIMapObjectWnd::SetActiveObject") );
|
|
|
|
if( pActiveObject != m_pActiveObject )
|
|
{
|
|
m_pActiveObject = pActiveObject;
|
|
|
|
OnUIMapActivateObject( m_pActiveObject );
|
|
|
|
InvalidateRect( NULL );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
void CLgUIMapObjectWnd::UpdateInfo( BOOL bOdd )
|
|
{
|
|
LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CLgUIMapObjectWnd::UpdateInfo"), _T("Started...") );
|
|
|
|
m_bOddUpdate = bOdd;
|
|
if( GetSafeHwnd() )
|
|
{
|
|
CClientDC dc( this );
|
|
OnDrawTimer( &dc );
|
|
}
|
|
|
|
LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CLgUIMapObjectWnd::UpdateInfo"), _T("Done") );
|
|
}
|
|
|
|
void CLgUIMapObjectWnd::OnDraw(CDC *pDC)
|
|
{
|
|
LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CLgUIMapObjectWnd::OnDraw"), _T("Started...") );
|
|
|
|
CLgUIMapWnd::OnDraw( pDC );
|
|
|
|
OnDrawTimer( pDC );
|
|
|
|
LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CLgUIMapObjectWnd::OnDraw"), _T("Done") );
|
|
}
|
|
|
|
void CLgUIMapObjectWnd::OnDrawBackground( CDC *pDC )
|
|
{
|
|
// log info
|
|
LGLOG( LOG_LEVEL_HIGH, LOG_TYPE_INFO, this, "CLgUIMapObjectWnd::OnDrawBackground", "Start..." );
|
|
|
|
CLgLocker Lock( &CLgLinkP<CLgUIMapObjectWnd,CLgUIMapObject>::GetLock() );
|
|
|
|
CLgArray< CLgLink<CLgUIMapObject,CLgUIMapObjectWnd>* > &arrObject = *this;
|
|
|
|
for( int i = 0; i < arrObject.GetCount(); i++ )
|
|
{
|
|
CLgUIMapObject *pObject = *arrObject[i];
|
|
|
|
ASSERT( pObject );
|
|
|
|
pObject->OnUIMapDrawBackground( this, pDC );
|
|
}
|
|
|
|
// log info
|
|
LGLOG( LOG_LEVEL_HIGH, LOG_TYPE_INFO, this, "CLgUIMapObjectWnd::OnDrawBackground", "Done" );
|
|
}
|
|
|
|
void CLgUIMapObjectWnd::OnDrawTimer( CDC *pDC )
|
|
{
|
|
LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CLgUIMapWnd::OnPaint"), _T("Started...") );
|
|
|
|
CLgLocker Lock( &CLgLinkP<CLgUIMapObjectWnd,CLgUIMapObject>::GetLock() );
|
|
|
|
CLgArray< CLgLink<CLgUIMapObject,CLgUIMapObjectWnd>* > &arrObject = *this;
|
|
|
|
for( int i = 0; i < arrObject.GetCount(); i++ )
|
|
{
|
|
CLgUIMapObject *pObject = *arrObject[i];
|
|
|
|
ASSERT( pObject );
|
|
|
|
pObject->OnUIMapDraw( this, pDC, m_pActiveObject == pObject, m_bOddUpdate );
|
|
}
|
|
|
|
LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CLgUIMapWnd::OnPaint"), _T("Done") );
|
|
}
|
|
|
|
CLgUIMapObject *CLgUIMapObjectWnd::OnUIMapHitTest( CLgDRect *pRect )
|
|
{
|
|
CLgLocker Lock( &CLgLinkP<CLgUIMapObjectWnd,CLgUIMapObject>::GetLock() );
|
|
|
|
CLgArray< CLgLink<CLgUIMapObject,CLgUIMapObjectWnd>* > &arrObject = *this;
|
|
|
|
for( int i = 0; i < arrObject.GetCount(); i++ )
|
|
{
|
|
CLgUIMapObject *pObject = *arrObject[i];
|
|
|
|
ASSERT( pObject );
|
|
|
|
if( pObject->OnUIMapHitTest( this, pRect ) )
|
|
return pObject;
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
BOOL CLgUIMapObjectWnd::RedrawObject( CLgUIMapObject *pObject )
|
|
{
|
|
LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CLgUIMapObjectWnd::RedrawObject") );
|
|
|
|
if( !pObject )
|
|
return FALSE;
|
|
|
|
OnChangeViewParams();
|
|
|
|
// InvalidateRect( NULL );
|
|
return TRUE;
|
|
}
|