- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
EyeDlg.cpp
资源名称:MoLecture.rar [点击查看]
上传用户:qinfarui
上传日期:2022-08-10
资源大小:362k
文件大小:3k
源码类别:
GIS编程
开发平台:
Visual C++
- // EyeDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "MoLecture.h"
- #include "EyeDlg.h"
- #include "MoLectureView.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CEyeDlg dialog
- CEyeDlg::CEyeDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CEyeDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CEyeDlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
- void CEyeDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CEyeDlg)
- DDX_Control(pDX, IDC_MAP1, m_EyeMap);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CEyeDlg, CDialog)
- //{{AFX_MSG_MAP(CEyeDlg)
- // NOTE: the ClassWizard will add message map macros here
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CEyeDlg message handlers
- BEGIN_EVENTSINK_MAP(CEyeDlg, CDialog)
- //{{AFX_EVENTSINK_MAP(CEyeDlg)
- ON_EVENT(CEyeDlg, IDC_MAP1, 5 /* BeforeTrackingLayerDraw */, OnBeforeTrackingLayerDrawMap1, VTS_I4)
- ON_EVENT(CEyeDlg, IDC_MAP1, -605 /* MouseDown */, OnMouseDownMap1, VTS_I2 VTS_I2 VTS_I4 VTS_I4)
- //}}AFX_EVENTSINK_MAP
- END_EVENTSINK_MAP()
- //画矩形范围框
- void CEyeDlg::OnBeforeTrackingLayerDrawMap1(long hDC)
- {
- // TODO: Add your control notification handler code here
- CFrameWnd *pFrame=(CFrameWnd *)(AfxGetApp()->m_pMainWnd);
- CMoLectureView *view=(CMoLectureView *)pFrame->GetActiveView();
- CMoRectangle mExtent =view->m_Map.GetExtent();
- CMoSymbol lSym;
- if (!lSym.CreateDispatch("MapObjects2.Symbol"))
- return;
- lSym.SetColor(moRed);
- lSym.SetSymbolType(moLineSymbol);
- lSym.SetSize(3);
- CMoPoint p;
- if (!p.CreateDispatch("MapObjects2.Point"))
- return;
- CMoPoints pts;
- if (!pts.CreateDispatch("MapObjects2.Points"))
- return;
- CMoLine l;
- if (!l.CreateDispatch("MapObjects2.Line"))
- return;
- p.SetX(mExtent.GetLeft());
- p.SetY(mExtent.GetBottom());
- pts.Add(p);
- p.SetX(mExtent.GetLeft());
- p.SetY(mExtent.GetTop());
- pts.Add(p);
- p.SetX(mExtent.GetRight());
- p.SetY(mExtent.GetTop());
- pts.Add(p);
- p.SetX(mExtent.GetRight());
- p.SetY(mExtent.GetBottom());
- pts.Add(p);
- p.SetX(mExtent.GetLeft());
- p.SetY(mExtent.GetBottom());
- pts.Add(p);
- l.GetParts().Add(pts);
- m_EyeMap.DrawShape(l,lSym);
- }
- //鹰眼视图控制主视图
- void CEyeDlg::OnMouseDownMap1(short Button, short Shift, long X, long Y)
- {
- // TODO: Add your control notification handler code here
- CFrameWnd *pFrame=(CFrameWnd *)(AfxGetApp()->m_pMainWnd);
- CMoLectureView *view=(CMoLectureView *)pFrame->GetActiveView();
- //得到主视图显示范围
- CMoRectangle mExtent =view->m_Map.GetExtent();
- //得到鹰眼视图当前点坐标
- CMoPoint pt = ToMapPoint(m_EyeMap,X,Y);
- CMoPoint c = mExtent.GetCenter();
- //将范围偏移
- mExtent.Offset(pt.GetX() - c.GetX(), pt.GetY() - c.GetY());
- //通知主视图范围变了
- view->m_Map.SetExtent(mExtent);
- //重新绘制鹰眼视图
- m_EyeMap.Refresh();
- }