清醒时做事,糊涂时读书,大怒时睡觉,无聊时关注图老师为大家准备的精彩内容。下面为大家推荐MapX之VC设置非地球坐标系,无聊中的都看过来。
【 tulaoshi.com - 编程语言 】
:MapX之VC设置非地球坐标系
:vc6+mapx4.5+win2k+sp3
:CoordSys.set设置非地球坐标系时,必须定义坐标范围
:www.51gis.com
int CMyGIsView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
// create map with default size
// resize message will cause it to be
// size to the client area of the view
m_ctrlMapX.Create(NULL, WS_VISIBLE, CRect(0,0,100,100), this, IDC_MAP);
m_ctrlMapX.SetGeoSet("Mygst.gst");
//-------以下代码设置nonearth(meters)坐标系-------------
CMapXRectangle Rect;
CMapXCoordSys CurrentCoordsys;
COptionalVariant vEmpty;
VARIANT MapUnit,MapBounds;
if(!Rect.CreateDispatch(Rect.GetClsid()))
{
TRACE0("Could not Create object");
}
if(!CurrentCoordsys.CreateDispatch(CurrentCoordsys.GetClsid())) {
TRACE0("Could not Create object");
}
try {
MapUnit.vt=VT_I4;
MapUnit.lVal=miUnitMeter;
//设置坐标范围(MBR).为求一致,这里取当GeosetManager中设置为non-earth(meters)时,
//gst文件中的参数"GEOSETMBRLOWERLEFT" ,"GEOSETMBRUPPERRIGHT"。
Rect.Set(-2165.540090678837, 9841.99939777,46782.41871417205,41026.85331473999);
MapBounds.vt=VT_DISPATCH;
MapBounds.pdispVal=Rect.m_lpDispatch;
MapBounds.pdispVal-AddRef();
CurrentCoordsys.Set(0, vEmpty,MapUnit, vEmpty, vEmpty, vEmpty,vEmpty, vEmpty, vEmpty, vEmpty, vEmpty, vEmpty,MapBounds, vEmpty);
m_ctrlMapX.SetNumericCoordSys(CurrentCoordsys.m_lpDispatch);
m_ctrlMapX.SetDisplayCoordSys(m_ctrlMapX.GetNumericCoordSys().m_lpDispatch);
} catch (COleDispatchException *e) {
e-ReportError();
e-Delete();
} catch (COleException *e) {
e-ReportError();
e-Delete();
}
//------------------------------------------------
return 0;
}
==================MapX专家论坛(www.51gis.com)===================
来源:http://www.tulaoshi.com/n/20160219/1602532.html
看过《MapX之VC设置非地球坐标系》的人还看了以下文章 更多>>