AE开发关于OnMapReplaced方法的使用原理

本文解析了OnMapReplaced事件的触发条件及其应用场景。详细介绍了该事件在地图替换时的作用,以及如何通过加载.mxd文件来触发此事件。同时探讨了在不替换地图的情况下,如何使用OnAfterScreenDraw方法实现类似的效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The OnMapReplaced event is triggered whenever the IMapControl2::Map is replaced by another map, such as when the IMapControl2::LoadMxFile method is used or when the map property is explicitly replaced. Use this event to keep in synch with the current map. 
问:这个方法在什么情况下被触发呢?
答:当MapControl 的地图被另一个地图替换时被触发。
问:为什么加载shp等数据时该方法不会被触发?
答:因为MapControl被初始化的时候就默认创建了一个地图文档,新加载的shp数据只是加载到了这个原始的地图文档中,并没有被替换,故该方法不会被触发。
问:那要怎么样才可以触发该事件?
答:加载地图文档,.mxd格式的数据就会触发该事件。
问:那我不想加载地图文档,只想加载shp数据该怎么实现鹰眼效果?
答:用OnAfterScreenDraw()方法。OnAfterScreenDraw is triggered after the IDisplayEvents::DisplayFinished event is called on the map's screen display. The hdc represents the device context on the screen display.

 

转载于:https://www.cnblogs.com/zzkgis/p/3742115.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值