void JunSuMFCDialogDlg::OnFileImporttif()
{
// TODO: 在此添加命令处理程序代码
UGWorkspace* pWorkspace = (UGWorkspace*)m_pMapControl->GetMapEditWnd()->m_mapWnd.m_Map.GetWorkspace();
UGDataExchange exchange = UGDataExchange();
UGDataSource* ds = pWorkspace->GetDataSource(0);
if (!ds)
{
return;
}
int issu = exchange.AttachDataSource(ds);
UGGTiffImportParams importparams = UGGTiffImportParams();
UGString NAME = ds->GetUnoccupiedDatasetName(_U("TIF"));
importparams.SetDestDTName(NAME);
importparams.SetFilePathName(_U("C:\\Users\\86182\\Desktop\\c++导入数据测试数据\\data\\tif\\dsm_4.tif"));
UGint ii = importparams.GetFileType();
int ss = UGExchangeParamsManager::IsValidImportParams(ii, importparams);
UGint issucceed = exchange.Import(importparams);
if (issucceed == 1)
{
UGDatasetRaster* dataset = (UGDatasetRaster*)ds->GetDataset(NAME);
dataset->BuildPyramid(false);
UGLayer* layer = m_pMapControl->GetMapEditWnd()->m_mapWnd.m_Map.m_Layers.AddDataset(dataset, true);
m_pMapControl->GetMapEditWnd()->m_mapWnd.m_Map.SetViewBounds(layer->GetBounds(), true);
m_pMapControl->Refresh();
}
else
{
//QMessageBox::information(NULL, QString::fromLocal8Bit("导入shp"), QString::fromLocal8Bit("导入失败"), QMessageBox::Close, QMessageBox::Close);
}