//保存图层到mxd文档
string mxdFileName="D:\test.mxd";
IWorkspace tempWorkspace = null;
List<ESRI.ArcGIS.Geodatabase.IFeatureClass> copyFCs=new List<ESRI.ArcGIS.Geodatabase.IFeatureClass>();
IMapControlDefault m_pMapCtrl = new MapControlClass();
foreach (var pFeatureClass in copyFCs)
{
IFeatureLayer featureLayer = new FeatureLayerClass();
featureLayer.FeatureClass = pFeatureClass;
m_pMapCtrl.AddLayer(featureLayer as ILayer, 0);
}
if (System.IO.File.Exists(mxdFileName))
{
System.IO.File.Delete(mxdFileName);
}
IMxdContents pMxdC = (IMxdContents)m_pMapCtrl.Map;
IMapDocument pMapDocument = new MapDocumentClass();
pMapDocument.New(mxdFileName);
IActiveView pActiveView = m_pMapCtrl.Map as IActiveView;
pMapDocument.ReplaceContents(pMxdC);
pMapDocument.Save(true, true);
Arcengine 保存图层到mxd
最新推荐文章于 2024-06-23 01:04:36 发布