Arcengine 打开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 gisoracle@126.com
private void button13_Click(object sender, EventArgs e)
{
ILayer pLayer = openTinLayer(@"D:\gisoracle\tin");
this.axMapControl1.AddLayer(pLayer);
}