分享给有需要的人,代码质量勿喷。
private void 加载打开TinToolStripMenuItem_Click(object sender, EventArgs e)
{
FolderBrowserDialog xjTinFolderBrowserDialog = new FolderBrowserDialog();
if (xjTinFolderBrowserDialog.ShowDialog() == DialogResult.OK)
{
string xjTinPath = xjTinFolderBrowserDialog.SelectedPath;
FileInfo xjFileInfo = new FileInfo(xjTinPath);
IWorkspaceFactory xjTinWorkspaceFactory = new TinWorkspaceFactoryClass();//using ESRI.ArcGIS.Geodatabase;DataSourcesFile;
ITinWorkspace xjTinWorkspace = xjTinWorkspaceFactory.OpenFromFile(xjFileInfo.DirectoryName, 0) as ITinWorkspace;
if (xjTinWorkspaceFactory.IsWorkspace(xjFileInfo.DirectoryName))
{
ITin xjTin = xjTinWorkspace.OpenTin(xjFileInfo.Name);
ITinLayer xjTinLayer = new TinLayerClass();
xjTinLayer.Dataset = xjTin;
ISceneGraph xjSceneGraph = this.axSceneControl1.SceneGraph;
IScene xjScene = xjSceneGraph.Scene;
xjScene.AddLayer(xjTinLayer as ILayer, true);
}
}
this.axSceneControl1.SceneGraph.RefreshViewers();
}
VS2010+ArcEngine10.1窗体+代码见:点击打开链接