码迷,mamicode.com
首页 > Windows程序 > 详细

AE+C#实现:在SceneControl里打开和保存

时间:2015-06-08 00:44:03      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:

来自:http://www.cnblogs.com/zhuxy/archive/2012/03/30/2424672.html

之前编写这段代码,发现一直没有C#编写的,现在贴出来,希望对大家有用

此程序实现保存后的文件,不能在ArcScene里面打开。但下面的打开程序一切通吃。。呵呵

打开代码:

技术分享
openFileDialog1.Title = "打开Scene文档";             openFileDialog1.Filter = "Scene文档(*.sxd)|*.sxd";             openFileDialog1.ShowDialog();             string filename = openFileDialog1.FileName;             if (axSceneControl1.CheckSxFile(filename))                 axSceneControl1.LoadSxFile(filename);             else             {                 IScene pScene = axSceneControl1.Scene;                 IMemoryBlobStream mbStream = new MemoryBlobStreamClass();                 IObjectStream objectStream = new ObjectStreamClass();                 mbStream.LoadFromFile(filename);                 IPersistStream pPersistStream = (ESRI.ArcGIS.esriSystem.IPersistStream)pScene;                 objectStream.Stream = mbStream;                 pPersistStream.Load(objectStream);                             }
技术分享

保存代码:

技术分享
IMemoryBlobStream mbStream = new MemoryBlobStreamClass();                         IObjectStream objectStream = new ObjectStreamClass();                         objectStream.Stream = mbStream;                         IPersistStream persistStream = (ESRI.ArcGIS.esriSystem.IPersistStream)axSceneControl1.Scene;                         persistStream.Save(objectStream, 1);
saveFileDialog1.Title = "保存Scene文档"; saveFileDialog1.Filter = "保存Scene文档(*.sxd)|*.sxd"; saveFileDialog1.ShowDialog(); string filename = saveFileDialog1.FileName;
mbStream.SaveToFile(filename); MessageBox.Show("OK");

AE+C#实现:在SceneControl里打开和保存

标签:

原文地址:http://www.cnblogs.com/gisoracle/p/4559660.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!