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

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.

 

posted on 2014-05-21 20:24  左小诸葛  阅读(1655)  评论(0编辑  收藏  举报