标签:
与加载其它文件略显不同之处在于TIN数据包含若干文件,具体代码如下:
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
if (folderBrowserDialog.ShowDialog()==DialogResult.OK)
{
string filePath = folderBrowserDialog.SelectedPath;//选择tin文件夹
string tinPath = Path.GetDirectoryName(filePath);//tin文件夹所在路径
string tinFilePath = Path.GetFileName(filePath);//tin文件夹名称
IWorkspaceFactory pWF = new TinWorkspaceFactoryClass();
IWorkspace pW = pWF.OpenFromFile(tinPath, 0);
ITinWorkspace pTW = pW as ITinWorkspace;
ITin pTin = pTW.OpenTin(tinFilePath);
ITinLayer pTL = new TinLayerClass();
pTL.Dataset = pTin;
axMapControl1.AddLayer(pTL);
}
标签:
原文地址:http://www.cnblogs.com/zhaosaiblogs/p/4968337.html