各位大虾好!
现在我正在做wince系统的嗲子地图设计,基本功能是打开地图和实现放大缩小,但是现在按照网上已有的MAPX的开发方法完全不对,添加了/*void CMapX_Mobile_WinceView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
if(cx!=0 && cy!=0)
m_ctrlMapX.MoveWindow(0,0,cx,cy,TRUE);//调整地图的大小,要为我们的客户区的大小相同
}*/
/*void CMapX_Mobile_WinceView::OnSetFocus(CWnd* pOldWnd)
{
CView::OnSetFocus(pOldWnd);
m_ctrlMapX.SetFocus();//确保只要窗口被激活MapX就获得焦点
}
在模拟器上会报错,不添加这个两个函数在模拟器上 不报错,但是地图不能正常显示
其中打开地图程序如下
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
//创建默认大小的地图
//if(!m_ctrlMapX.Create(NULL,WS_VISIBLE, CRect(0,0,50,50),this,IDC_MAP))
//RECT windRect;
//GetClientRect(&windRect);
CRect rect;
this->GetClientRect(&rect);
//if (!m_ctrlMapX.Create(NULL, WS_VISIBLE, windRect, this,IDC_MAP))
TRY {
// create map with default size - resize message will cause it to be
// sized to the client area of the view
// pass a license key so the .lic file is not needed
// this key allows SW access and themes, etc
CString strLic = _T("uQnZi2sFw22L0-MRa8pYX-1E4P9013-5N7M4407-3C934214-04969-5285");
BSTR bstrLic = strLic.AllocSysString();
BOOL b = m_ctrlMapX.Create(NULL, WS_VISIBLE, CRect(0,0,100,100), this, IDC_MAP, NULL, FALSE, bstrLic);
::SysFreeString(bstrLic);
if (!b) {
b = m_ctrlMapX.Create(NULL, WS_VISIBLE, CRect(0,0,100,100), this, 100, NULL, FALSE, NULL);
}
if (!b) {
AfxMessageBox(_T("Can't Create MapX"));
return FALSE;
}
m_ctrlMapX.SetGeoSet(_T("\\My Documents\\Maps\\ASIA.GST")); //指定地图集
m_ctrlMapX.SetTitleText(_T("china"));
double m_dInitZoom=m_ctrlMapX.GetZoom();
if (m_dInitZoom <= 0)
{ MessageBox(_T("未指定地图集,请确认地图数据是否正确安装。")); }
m_ctrlMapX.GetTitle().SetVisible(FALSE);
m_ctrlMapX.SetCurrentTool(miZoomInTool);
//m_ctrlMapX.CreateCustomTool(MYTOOL_DISTANCE,miToolTypePoly,miCrossCursor);
m_ctrlMapX.CreateCustomTool(99, miToolTypePoint, miInfoCursor); // cursor can't be seen on pocketpc
//m_ctrlMapX.SetPreferCompactLegends(TRUE);
}
CATCH (COleDispatchException,e) {
e->ReportError();
//e->Delete();
}
AND_CATCH (COleException,e) {
e->ReportError();
//e->Delete();
}
END_CATCH
return -1;
return 0;
}
请有做过这方面开发的指点下,如能得到你们的帮助将不胜感激!!!!
------解决方案--------------------
你要的这个功能在MapX Mobile安装目录下的sample就有,叫MapXMobileViewer,如果找不到,可以在以下目录下载,n年前我上传到pudn。
http://www.pudn.com/downloads45/sourcecode/graph/detail152025.html
------解决方案--------------------
以前做过 有些资料 可以给你看看呢