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.
150 lines
4.4 KiB
150 lines
4.4 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 08/10/2003
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: LgUIMapWholeWnd.cpp
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file of LgUIMapWholeWnd.cpp
|
|
//----------------------------------------------------------------------------
|
|
#include "stdafx.h"
|
|
#include "..\Version.h"
|
|
#include "LgUIMapWholeWnd.h"
|
|
#include "LgUIMapZoomWnd.h"
|
|
#include "LgUIMapEngine.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
BEGIN_MESSAGE_MAP( CLgUIMapWholeWnd, CLgUIMapObjectWnd )
|
|
//{{AFX_MSG_MAP(CLgUIMapWholeWnd)
|
|
ON_WM_LBUTTONDOWN()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
CLgUIMapWholeWnd::CLgUIMapWholeWnd()
|
|
{
|
|
// log info
|
|
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, "CLgUIMapWholeWnd::CLgUIMapWholeWnd" );
|
|
}
|
|
|
|
CLgUIMapWholeWnd::~CLgUIMapWholeWnd()
|
|
{
|
|
CLgLink<CLgUIMapWholeWnd,CLgUIMapEngine>::Unlink();
|
|
CLgLinkS<CLgUIMapWholeWnd,CLgUIMapZoomWnd>::Unlink();
|
|
|
|
// log info
|
|
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, "CLgUIMapWholeWnd::~CLgUIMapWholeWnd" );
|
|
}
|
|
|
|
void CLgUIMapWholeWnd::OnLButtonDown(UINT nFlags, CPoint point)
|
|
{
|
|
// get zoom map
|
|
CLgUIMapZoomWnd *pZoomWnd = *this; //CLgLinkS<CLgUIMapWholeWnd,CLgUIMapZoomWnd>::GetLinkThis();
|
|
|
|
// change zoomed area position
|
|
if( pZoomWnd )
|
|
pZoomWnd->SetCenter( &WindowToArea( &point ) );
|
|
|
|
// determine object under cursor
|
|
CRect WndRect( point.x - 3, point.y - 3, point.x + 3, point.y + 3 );
|
|
CLgDRect AreaRect( WindowToArea( &WndRect ) );
|
|
CLgUIMapObject *pActiveObject = CLgUIMapObjectWnd::OnUIMapHitTest( &AreaRect );
|
|
if( pActiveObject )
|
|
SetActiveObject( pActiveObject );
|
|
// else
|
|
// InvalidateRect( NULL );
|
|
|
|
CLgUIMapWnd ::OnLButtonDown(nFlags, point);
|
|
}
|
|
|
|
void CLgUIMapWholeWnd::OnDrawTimer( CDC *pDC )
|
|
{
|
|
LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CLgUIMapWholeWnd::OnDrawTimer"), _T("Started...") );
|
|
|
|
CLgUIMapObjectWnd::OnDrawTimer( pDC );
|
|
|
|
// get zoom map
|
|
CLgUIMapZoomWnd *pZoomWnd = *this;//CLgLinkS<CLgUIMapWholeWnd,CLgUIMapZoomWnd>::GetLinkBaseClass();
|
|
|
|
// if zoomed area assigned
|
|
if( !pZoomWnd )
|
|
{
|
|
LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CLgUIMapWholeWnd::OnDrawTimer"), _T("Done (no zoom)") );
|
|
return;
|
|
}
|
|
|
|
CRect rect = AreaToWindow( &pZoomWnd->GetVisibleArea() );
|
|
|
|
COLORREF color[2] = { RGB(0xFF,0xFF,0xFF), RGB(0,0,0) };
|
|
|
|
CPen pen( PS_DOT, 1, m_bOddUpdate ? color[0] : color[1] );
|
|
|
|
CPen *pPen = pDC->SelectObject( &pen );
|
|
int nBkColor = pDC->SetBkColor( m_bOddUpdate ? color[1] : color[0] );
|
|
|
|
pDC->MoveTo( rect.left, rect.top );
|
|
pDC->LineTo( rect.right, rect.top );
|
|
pDC->LineTo( rect.right, rect.bottom );
|
|
pDC->LineTo( rect.left, rect.bottom );
|
|
pDC->LineTo( rect.left, rect.top );
|
|
|
|
pDC->SetBkColor( nBkColor );
|
|
pDC->SelectObject( pPen );
|
|
|
|
LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CLgUIMapWholeWnd::OnDrawTimer"), _T("Done (with zoom)") );
|
|
}
|
|
|
|
BOOL CLgUIMapWholeWnd::SetActiveObject( CLgUIMapObject *pActiveObject )
|
|
{
|
|
LGLOG( LOG_LEVEL_REALTIME, LOG_TYPE_INFO, this, _T("CLgUIMapWholeWnd::SetActiveObject") );
|
|
|
|
if( CLgUIMapObjectWnd::SetActiveObject( pActiveObject ) )
|
|
{
|
|
// get zoom map
|
|
CLgUIMapZoomWnd *pZoomWnd = *this; //CLgLinkS<CLgUIMapWholeWnd,CLgUIMapZoomWnd>::GetLinkBaseClass();
|
|
|
|
// if zoomed area assigned
|
|
if( pZoomWnd )
|
|
pZoomWnd->SetActiveObject( pActiveObject );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL CLgUIMapWholeWnd::Link( CLgLink<CLgUIMapObject,CLgUIMapObjectWnd>* pObject )
|
|
{
|
|
// link itself
|
|
if( !CLgLink<CLgUIMapObjectWnd,CLgUIMapObject>::Link(pObject) )
|
|
return FALSE;
|
|
|
|
// link also from Zoom map
|
|
CLgUIMapZoomWnd *pZoomWnd = *this;//CLgLinkS<CLgUIMapWholeWnd,CLgUIMapZoomWnd>::GetLinkBaseClass();
|
|
if( pZoomWnd )
|
|
pZoomWnd->CLgLink<CLgUIMapObjectWnd,CLgUIMapObject>::Link( pObject );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CLgUIMapWholeWnd::Unlink( CLgLink<CLgUIMapObject,CLgUIMapObjectWnd>* pObject )
|
|
{
|
|
// unlink itself
|
|
if( !CLgLink<CLgUIMapObjectWnd,CLgUIMapObject>::Unlink(pObject) )
|
|
return FALSE;
|
|
|
|
// unlink also from Zoom map
|
|
CLgUIMapZoomWnd *pZoomWnd = *this; //CLgLinkS<CLgUIMapWholeWnd,CLgUIMapZoomWnd>::GetLinkBaseClass();
|
|
if( pZoomWnd )
|
|
pZoomWnd->CLgLink<CLgUIMapObjectWnd,CLgUIMapObject>::Unlink( pObject );
|
|
|
|
return TRUE;
|
|
}
|