//create a new instance of IMaps collection which is needed by the PageLayout
//创建一个 PageLayout 需要用到的,新的 IMaps collection 的实例
IMaps maps = new Maps();
//add the new map to the Maps collection
//把新的地图加到 Maps collection 里头去
maps.Add(newMap);
bool bIsMapActive = m_IsMapCtrlactive;
//call replace map on the PageLayout in order to replace the focus map
//we must call ActivatePageLayout, since it is the control we call 'ReplaceMaps'
//调用 PageLayout 的 replace map 来置换 focus map
//我们必须调用 ActivatePageLayout,因为它是那个我们可以调用"ReplaceMaps"的 Control
this.ActivatePageLayout();
m_pageLayoutControl.PageLayout.ReplaceMaps(maps);
//assign the new map to the MapControl
//把新的地图赋给 MapControl
m_mapControl.Map = newMap;
//reset the active tools
//重设 active tools
m_pageLayoutActiveTool = null;
m_mapActiveTool = null;
//make sure that the last active control is activated
//确认之前活动的 control 被激活
if (bIsMapActive)
{
this.ActivateMap();
m_mapControl.ActiveView.Refresh();
}
else
{
this.ActivatePageLayout();
m_pageLayoutControl.ActiveView.Refresh();
}
}
/// <summary>
/// bind the MapControl and PageLayoutControl together by assigning a new joint focus map
/// 指定共同的 Map 来把 MapControl 和 PageLayoutControl 绑在一起
/// </summary>
/// <param name="mapControl"></param>
/// <param name="pageLayoutControl"></param>
/// <param name="activateMapFirst">true if the MapControl supposed to be activated first,如果 MapControl 被首先激活,
则为 true</param>
public void BindControls(IMapControl3 mapControl, IPageLayoutControl2 pageLayoutControl, bool activateMapFirst)
{
if (mapControl == null || pageLayoutControl == null)
throw new Exception("ControlsSynchronizer::BindControls:\r\nEither MapControl or PageLayoutControl are not
initialized!");
m_mapControl = MapControl;
m_pageLayoutControl = pageLayoutControl;
this.BindControls(activateMapFirst);
}
/// <summary>
/// bind the MapControl and PageLayoutControl together by assigning a new joint focus map
/// 指定共同的 Map 来把 MapControl 和 PageLayoutControl 绑在一起
/// </summary>
/// <param name="activateMapFirst">true if the MapControl supposed to be activated first,如果 MapControl 被首先激活,
则为 true</param>
public void BindControls(bool activateMapFirst)
{