📄 identifydlg.cpp
字号:
// CIdentifyDlg.cpp : Implementation of CCIdentifyDlg
#include "stdafx.h"
#include "IdentifyDlg.h"
#include ".\identifydlg.h"
//#include "Raster.h"
//#include "ShapeFile.h"
// CIdentifyDlg
void CIdentifyDlg::Show(const IPointPtr& cpPoint,const IActiveViewPtr& cpActiveView,BOOL bAdd)
{
if (NULL==cpPoint||NULL==cpActiveView)
return;
HRESULT hr;
try
{
IPointPtr mcpPoint;
IActiveViewPtr mcpActiveView;
mcpPoint=cpPoint;
mcpActiveView=cpActiveView;
IMapPtr cpMap;
cpMap=mcpActiveView;
long count;
hr=cpMap->get_LayerCount(&count);
if (0==count) //no layer in the map
{
ShowHelp(mcpActiveView);
return;
}
ShowPostion(mcpPoint);
}
catch (_com_error &e)
{
GeoBase::Dealerror(e);
}
}
void CIdentifyDlg::ShowLayer(const IActiveViewPtr& cpActiveView)
{
}
void CIdentifyDlg::ShowList(const IFeaturePtr& cpFeature)
{
}
void CIdentifyDlg::ShowTree(const std::vector<IFeaturePtr>& cpFeatures,
const IFeaturePtr& cpCloestFeature,
BOOL bAdd)
{
}
void CIdentifyDlg::ShowHelp(const IActiveViewPtr& cpActiveView)
{
}
void CIdentifyDlg::ShowPostion(const IPointPtr& cpPoint)
{
HRESULT hr;
DOUBLE x,y;
hr=cpPoint->get_X(&x);
hr=cpPoint->get_Y(&y);
char buffer[200];
sprintf(buffer,"%f,%f",x,y);
CString text=_T("位置:");
text+=buffer;
m_winStatic.SetWindowText(text);
}
//Get the Features around at cpPoint
void CIdentifyDlg::GetCloestFeature(const IActiveViewPtr& cpActiveView,
const IPointPtr& cpPoint,
std::vector<IFeaturePtr>& vecFeatures,
const IFeaturePtr& cpCloestFeature)
{
IEnvelopePtr cpEnvelope;
HRESULT hr;
hr=cpPoint->get_Envelope(&cpEnvelope);
assert(SUCCEEDED(hr));
DOUBLE dblDist;
dblDist=4; //4 pixels is a reasonable amount
dblDist=GeoBase::ConvertPixelsToMapUnits(cpActiveView,dblDist);
hr=cpEnvelope->put_Width(dblDist);
hr=cpEnvelope->put_Height(dblDist);
hr=cpEnvelope->CenterAt(cpPoint);
}
void CIdentifyDlg::set_isShow(BOOL show)
{
m_isShow=show;
}
BOOL CIdentifyDlg::get_isShow()
{
return m_isShow;
}
LRESULT CIdentifyDlg::OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/)
{
// TODO: Add your message handler code here and/or call default
DWORD cx=LOWORD(lParam);
DWORD cy=HIWORD(lParam);
if (m_winListCtl&&m_winTreeCtl&&m_winStatic)
{
RECT TreeRect;
m_winTreeCtl.GetWindowRect(&TreeRect);
RECT ListRect;
m_winListCtl.GetWindowRect(&ListRect);
RECT StaticRect;
m_winStatic.GetWindowRect(&StaticRect);
cy=cy-45;
if (cy>0)
{
m_winTreeCtl.MoveWindow(5,40,TreeRect.right-TreeRect.left,cy);
}
cx=cx-15-(TreeRect.right-TreeRect.left);
cy=cy-22;
if (cx>0&&cy>0)
{
m_winListCtl.MoveWindow(10+(TreeRect.right-TreeRect.left),62,cx,cy);
}
if (cx>0)
{
m_winStatic.MoveWindow(10+(TreeRect.right-TreeRect.left),40,cx,17);
}
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -