Arcengine C#打开Tin

public static ILayer openTinLayer(string fullPath) { ITinWorkspace pTinWorkspace; IWorkspace pWS; IWorkspaceFactory pWSFact = new TinWorkspaceFactoryClass(); ITinLayer pTinLayer = new TinLayerClass(); string pathToWorkspace = System.IO.Path.GetDirectoryName(fullPath); string tinName = System.IO.Path.GetFileName(fullPath); ITin pTin; pWS = pWSFact.OpenFromFile(pathToWorkspace, 0); pTinWorkspace = pWS as ITinWorkspace; if (pTinWorkspace.get_IsTin(tinName)) { pTin = pTinWorkspace.OpenTin(tinName); pTinLayer.Dataset = pTin; pTinLayer.ClearRenderers(); return pTinLayer as ILayer; } else { MessageBox.Show("该目录不包含Tin文件"); return null; } } //测试例子 by [email protected] private void button13_Click(object sender, EventArgs e) { ILayer pLayer = openTinLayer(@"D:/gisoracle/tin"); this.axMapControl1.AddLayer(pLayer); }

根据网页整理:http://bbs.esrichina-bj.cn/ESRI/thread-14081-1-1.html

你可能感兴趣的:(Arcengine C#打开Tin)