|
发表于 2013-9-13 14:45:18
|
显示全部楼层
可以试试这个代码
//加载高程数据
BOOL CCustomOSGWnd::AddDemLayer(Map* pMap)
{
TCHAR szPath[MAX_PATH];
::GetModuleFileName(NULL, szPath, MAX_PATH);
CString strPath(szPath);
int nIndex = strPath.ReverseFind('\\');
strPath = strPath.Left(nIndex);
CString strGlobalImageFile = strPath + "\\srtm_59_07.tif";
CString strGlobalImageLayerName = "Globe DEM Layer";
CFileFind fileFind;
if (fileFind.FindFile(strGlobalImageFile))
{
GDALOptions dem;
dem.url() = strGlobalImageFile.GetBuffer(); //若加载全球90m数据时,由于数据量较大,显示不流畅
ElevationLayer* layer = new ElevationLayer( strGlobalImageLayerName.GetBuffer(), dem );
m_pMap->addElevationLayer( layer );
}
return TRUE;
} |
|