IMapDocument.ReplaceContents(IMxdContents pObject)

Replaces the contents of the MapDocument with the contents of the specified Map, PageLayout, MapControl or PageLayoutControl. Before using the ReplaceContents method a New MapDocument must be created or an existing MapDocument must be Open.

If a MapControl  is passed to the ReplaceContents method the MapDocument will be replaced with the IMapControl2::Map. Likewise, if a PageLayoutControl is passed to the ReplaceContents method the MapDocument will be replaced with the IPageLayoutControl::PageLayout.

If the MapDocument contents is replaced with the contents of a Map or MapControl a portriat PageLayout containing the map will be created.

 在使用这个方法之前,或者建立一个新文档或者打开一个已经存在的新文档.

如果MapControl传给方法,MXD文档将要被IMapControl2::Map代替.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,关于在C#开发中调用ArcGIS中GP工具Erase、SymDiff,您可以使用ArcObjects中的Geoprocessor对象来调用这些工具。以下是示例代码: ```csharp using ESRI.ArcGIS.Geoprocessor; using ESRI.ArcGIS.AnalysisTools; using ESRI.ArcGIS.Carto; // 获取当前地图文档 IMapDocument mapDocument = new MapDocumentClass(); mapDocument.Open(@"C:\data\map.mxd"); IMap map = mapDocument.ActiveView.FocusMap; // 创建Geoprocessor对象 Geoprocessor gp = new Geoprocessor(); // 设置工作空间 gp.SetEnvironmentValue("workspace", @"C:\data"); // 定义输入要素和擦除要素 string in_features = @"C:\data\input.shp"; string erase_features = @"C:\data\erase.shp"; // 定义输出要素 string out_features = @"C:\data\output.shp"; // 创建Erase工具对象 Erase erase = new Erase(); erase.in_features = in_features; erase.erase_features = erase_features; erase.out_feature_class = out_features; // 执行Erase工具 gp.Execute(erase, null); // 定义输入要素 string in_features1 = @"C:\data\input1.shp"; string in_features2 = @"C:\data\input2.shp"; // 定义输出要素 string out_features2 = @"C:\data\output2.shp"; // 创建SymDiff工具对象 SymDiff symDiff = new SymDiff(); symDiff.in_features = in_features1 + ";" + in_features2; symDiff.out_feature_class = out_features2; // 执行SymDiff工具 gp.Execute(symDiff, null); ``` 以上代码中,我们首先获取当前地图文档,然后创建Geoprocessor对象并设置工作空间。接着,我们分别定义输入要素和擦除要素,以及输出要素,并创建Erase工具对象和SymDiff工具对象。最后,我们通过执行Geoprocessor对象的Execute方法来执行这些工具。 希望这个示例代码可以帮助您完成在C#开发中调用ArcGIS中GP工具Erase、SymDiff的任务。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值