/// <summary> /// given a new map, replaces the PageLayoutControl and the MapControl's focus map /// </summary> /// <param name="newMap"></param> public void ReplaceMap(IMap newMap) { if (newMap == null) { throw new Exception("ControlsSynchronizer::ReplaceMap:\r\nNew map for replacement is not initialized!"); } if (m_pageLayoutControl == null || m_mapControl == null) { throw new Exception("ControlsSynchronizer::ReplaceMap:\r\nEither MapControl or PageLayoutControl are not initialized!"); } //create a new instance of IMaps collection which is needed by the PageLayout IMaps maps = new Maps(); //add the new map to the 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' this.ActivatePageLayout(); m_pageLayoutControl.PageLayout.ReplaceMaps(maps); //assign the new map to the MapControl m_mapControl.Map = newMap; //reset the active tools m_pageLayoutActiveTool = null; m_mapActiveTool = null; //make sure that the last active control is activated 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 /// </summary> /// <param name="activateMapFirst">true if the MapControl supposed to be activated first</param> public void BindControls(bool activateMapFirst) { if (m_pageLayoutControl == null || m_mapControl == null) { throw new Exception("ControlsSynchronizer::BindControls:\r\nEither MapControl or PageLayoutControl are not initialized!"); } //create a new instance of IMap IMap newMap = new MapClass(); newMap.Name = "Map"; //create a new instance of IMaps collection which is needed by the PageLayout IMaps maps = new Maps(); //add the new Map instance to the Maps collection maps.Add(newMap); //call replace map on the PageLayout in order to replace the focus map m_pageLayoutControl.PageLayout.ReplaceMaps(maps); //assign the new map to the MapControl m_mapControl.Map = newMap; //reset the active tools m_pageLayoutActiveTool = null; m_mapActiveTool = null; //make sure that the last active control is activated if (activateMapFirst) { this.ActivateMap(); } else { this.ActivatePageLayout(); } }
/// <summary> /// bind the MapControl and PageLayoutControl together by assigning a new joint focus map /// </summary> /// <param name="activateMapFirst">true if the MapControl supposed to be activated first</param> public void BindControls(bool activateMapFirst) { if (m_pageLayoutControl == null || m_mapControl == null) throw new Exception("ControlsSynchronizer::BindControls:\r\nEither MapControl or PageLayoutControl are not initialized!"); //create a new instance of IMap IMap newMap = new MapClass(); newMap.Name = "Map"; //create a new instance of IMaps collection which is needed by the PageLayout IMaps maps = new Maps(); //add the new Map instance to the Maps collection maps.Add(newMap); //call replace map on the PageLayout in order to replace the focus map m_pageLayoutControl.PageLayout.ReplaceMaps(maps); //assign the new map to the MapControl m_mapControl.Map = newMap; //reset the active tools m_pageLayoutActiveTool = null; m_mapActiveTool = null; //make sure that the last active control is activated if (activateMapFirst) this.ActivateMap(); else this.ActivatePageLayout(); }
/// <summary> /// given a new map, replaces the PageLayoutControl and the MapControl's focus map /// </summary> /// <param name="newMap"></param> public void ReplaceMap(IMap newMap) { if (newMap == null) throw new Exception("ControlsSynchronizer::ReplaceMap:\r\nNew map for replacement is not initialized!"); if (m_pageLayoutControl == null || m_mapControl == null) throw new Exception("ControlsSynchronizer::ReplaceMap:\r\nEither MapControl or PageLayoutControl are not initialized!"); //create a new instance of IMaps collection which is needed by the PageLayout IMaps maps = new Maps(); //add the new map to the 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' this.ActivatePageLayout(); m_pageLayoutControl.PageLayout.ReplaceMaps(maps); //assign the new map to the MapControl m_mapControl.Map = newMap; //reset the active tools m_pageLayoutActiveTool = null; m_mapActiveTool = null; //make sure that the last active control is activated if (bIsMapActive) { this.ActivateMap(); m_mapControl.ActiveView.Refresh(); } else { this.ActivatePageLayout(); m_pageLayoutControl.ActiveView.Refresh(); } }