阅读:1903回复:4
大家用AE开发,用不用MXD文档?
大家用AE开发,用不用MXD文档?用的好处是什么,不用的理由又是什么?
|
|
1楼#
发布于:2005-04-12 10:39
<P>当然用了</P><P>要不符号怎么保存</P>
|
|
|
2楼#
发布于:2005-04-12 11:07
有道理.还有图层顺序,element的保存.大家在开发过程中想想用MXD还有什么好处!欢迎发表看法
|
|
3楼#
发布于:2005-04-12 11:18
<P>顺便贴一个命令.实现得到pagelayoutControl关联的mxd文档,并删除其中的最顶端图层</P><P>using System;
using System.Windows.Forms; using System.Runtime.InteropServices;</P><P>using ESRI.ArcGIS.SystemUI; using ESRI.ArcGIS.esriSystem; using ESRI.ArcGIS.Carto; using ESRI.ArcGIS.PageLayoutControl; using ESRI.ArcGIS.Display; using ESRI.ArcGIS.Utility.BaseClasses; using ESRI.ArcGIS.ControlCommands; using ESRI.ArcGIS.Utility.CATIDs;</P><P>namespace Commands { /// <summary> /// Summary description for cmdDelLayer. /// </summary> [Guid("fd14ad9f-665d-433e-97f0-6021c71478c2")] public class cmdDelLayer:BaseCommand { #region "Component Category Registration" [ComRegisterFunction()] static void Reg(string regKey) { ControlsCommands.Register(regKey); }</P><P> [ComUnregisterFunction()] static void Unreg(string regKey) { ControlsCommands.Unregister(regKey); } #endregion</P><P> IHookHelper engHook = new HookHelperClass(); //IMapDocument mxdDoc = null; ESRI.ArcGIS.PageLayoutControl.IPageLayoutControl2 mapCtrl = null; public cmdDelLayer() { base.m_caption = "delLayer"; base.m_category = "mapViewer"; base.m_enabled = true; base.m_message = "删除地图文档中最顶端图层"; base.m_name = "delLayer"; base.m_toolTip = "删除最顶端图层"; } public override void OnClick() { // TOD Add cmdDelLayer.OnClick implementation try { if(mapCtrl == null) { MessageBox.Show("没有得到MapControl"); return; } string docPath = mapCtrl.DocumentFilename; IMapDocument mxdDoc = new MapDocumentClass(); mxdDoc.Open(docPath,""); if(mxdDoc.get_IsReadOnly(docPath)) { MessageBox.Show("地图文档只读,不可修改!" ); return; } else {</P><P> if(mxdDoc.MapCount == 0 )return; IMap pMap = mxdDoc.get_Map(0); if(pMap.LayerCount != 0)pMap.DeleteLayer(pMap.get_Layer(0)); mxdDoc.Save(true,true); if(mapCtrl.CheckMxFile(docPath)) mapCtrl.LoadMxFile(docPath,null); //一定要重新加载地图文档,才能刷新显示地图文档已改变 mapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography,null,null); //mxdDoc.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography,null,null); } //object o1 = Type.Missing,o2 = Type.Missing; } catch(COMException e) { MessageBox.Show("com删除图层出错:" + e.Message); } catch(Exception e) { MessageBox.Show("删除图层出错:" + e.Message); } //base.OnClick (); } public override void OnCreate(object hook) { // TOD Add cmdDelLayer.OnCreate implementation //if(hook is IMapControl3) mapCtrl = (IPageLayoutControl2)hook; } } }</P> |
|
4楼#
发布于:2005-04-12 13:46
<img src="images/post/smile/dvbbs/em01.gif" />
|
|