码迷,mamicode.com
首页 > 其他好文 > 详细

AE中保存Mxd文档的几种方式

时间:2015-11-24 16:06:35      阅读:194      评论:0      收藏:0      [点我收藏+]

标签:

   public void ReplaceContents (IMxdContents pObject);保存修改;
 public void Save ( bool bUseRelativePaths,bool bCreateThumnbail);
 public void SaveAs (string sDocument,bool bUseRelativePaths,bool bCreateThumnbail);

IMxdContents接口:Provides access to members to pass data into and out off a MXD map document file. Coclasses that implement this interface can limited the implementation to one property if required.

1 新建一个Mxd空白文档:

          string path=@"f:\TEST\untitled.mxd";

            MapDocument pMapDocument = new MapDocumentClass();

            pMapDocument.New(path);

            pMapDocument.Open(path, "");

            axMapControl1.Map = pMapDocument.get_Map(0);

2 在打开一个Mxd文档进行修改、编辑再保存在原文件里面:

           IMxdContents pMxdC;

            pMxdC = axMapControl1.Map as IMxdContents;

            IMapDocument pMapDocument = new MapDocumentClass();

            pMapDocument.Open(axMapControl1.DocumentFilename, "");

            IActiveView pActiveView = axMapControl1.Map as IActiveView;

            pMapDocument.ReplaceContents(pMxdC);

            pMapDocument.Save(true, true);

3 自定义加载各种数据,也就是一开始就没有Mxd文档,之后进行修改、编辑,把当前地图保存为一个Mxd文档

          SaveFileDialog Sfd = new SaveFileDialog();

            Sfd.Title = "另存文档";

            Sfd.Filter = "(*.mxd)|*.mxd";

            Sfd.ShowDialog();

            string path = Sfd.FileName;

            IMxdContents pMxdC;

            pMxdC = axMapControl1.Map as IMxdContents;

            IMapDocument pMapDocument = new MapDocumentClass();

            pMapDocument.New(path);

            IActiveView pActiveView = axMapControl1.Map as IActiveView;

            pMapDocument.ReplaceContents(pMxdC);

            pMapDocument.Save(true, true);

AE中保存Mxd文档的几种方式

标签:

原文地址:http://www.cnblogs.com/janeaiai/p/4991784.html

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