private ISymbolShadow m_SymbolShadow; //阴影 public frmLegendWizard(IMap pmap, IPageLayoutControlDefault pPageLayoutControl, IMapSurroundFrame pMapSurroundFrame) {//用于在 任意范围打印的对话框 中编辑图例 InitializeComponent(); mapSurroundFrame = pMapSurroundFrame; m_pageLayoutControl = pPageLayoutControl; m_Map = pmap; }
public frmLegendWizard(IMapControlDefault mapControl, IPageLayoutControlDefault pagelayoutControl) { InitializeComponent(); m_mapControl = mapControl; m_pageLayoutControl = pagelayoutControl; // m_legend = pLegend; }
/// <summary> /// 生成一个默认指北针 /// </summary> /// <param name="pageLayoutControl"></param> /// <param name="startX"></param> /// <param name="startY"></param> /// <returns></returns> public static IMapSurround GetDefaultNortthArrow(IPageLayoutControlDefault pageLayoutControl, double startX, double startY) { try { IPageLayout pageLayout = pageLayoutControl.PageLayout; IActiveView pActiveView = pageLayoutControl.ActiveView; IMap map = pActiveView.FocusMap; if (pageLayout == null || map == null) { return(null); } IEnvelope envelope = new EnvelopeClass(); envelope.PutCoords(startX, startY, startX + 48, startY + 48); // Specify the location and size of the north arrow IUID uid = new UIDClass(); uid.Value = "esriCarto.MarkerNorthArrow"; // Create a Surround. Set the geometry of the MapSurroundFrame to give it a location IGraphicsContainer graphicsContainer = pageLayout as IGraphicsContainer; // Dynamic Cast IActiveView activeView = pageLayout as IActiveView; // Dynamic Cast IFrameElement frameElement = graphicsContainer.FindFrame(map); IMapFrame mapFrame = frameElement as IMapFrame; // Dynamic Cast IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid as ESRI.ArcGIS.esriSystem.UID, null); // Dynamic Cast IElement element = mapSurroundFrame as IElement; // Dynamic Cast element.Geometry = envelope; IMapSurround mapSurround = mapSurroundFrame.MapSurround; return(mapSurround); } catch (System.Exception ex) { return(null); } }
public ChangeFrameBorder(IElement pElement,IPageLayoutControlDefault pageLayoutControl) { // // TODO: Define values for the public properties // base.m_category = "设置边框样式"; //localizable text base.m_caption = "设置边框样式"; //localizable text base.m_message = "This should work in ArcMap/MapControl/PageLayoutControl"; //localizable text base.m_toolTip = "设置边框样式"; //localizable text base.m_name = "设置边框样式"; //unique id, non-localizable (e.g. "MyCategory_MyCommand") m_pageLayoutControl = pageLayoutControl; m_element = pElement; try { // // TODO: change bitmap name if necessary // string bitmapResourceName = GetType().Name + ".bmp"; base.m_bitmap = new Bitmap(GetType(), bitmapResourceName); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap"); } }
/// <summary> /// class constructor /// </summary> /// <param name="mapControl"></param> /// <param name="pageLayoutControl"></param> public ControlsSynchronizer(IMapControlDefault mapControl, IPageLayoutControlDefault pageLayoutControl) : this() { //assign the class members m_mapControl = mapControl; m_pageLayoutControl = pageLayoutControl; }
public ChangeFrameShadow(IElement pElement, IPageLayoutControlDefault pageLayoutControl) { // // TODO: Define values for the public properties // base.m_category = "设置图框阴影"; //localizable text base.m_caption = "设置图框阴影"; //localizable text base.m_message = "This should work in ArcMap/MapControl/PageLayoutControl"; //localizable text base.m_toolTip = "设置图框阴影"; //localizable text base.m_name = "设置图框阴影"; //unique id, non-localizable (e.g. "MyCategory_MyCommand") m_pageLayoutControl = pageLayoutControl; m_element = pElement; try { // // TODO: change bitmap name if necessary // string bitmapResourceName = GetType().Name + ".bmp"; base.m_bitmap = new Bitmap(GetType(), bitmapResourceName); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap"); } }
/// <summary> /// 生成默认比例尺 /// </summary> /// <param name="pageLayoutControl"></param> /// <param name="startX"></param> /// <param name="startY"></param> /// <returns></returns> public static IMapSurround GetDefaultScaleBar(IPageLayoutControlDefault pageLayoutControl, double startX, double startY) { try { IPageLayout pageLayout = pageLayoutControl.PageLayout; IGraphicsContainer container = pageLayout as IGraphicsContainer; IActiveView activeView = pageLayout as IActiveView; // 获得MapFrame IFrameElement frameElement = container.FindFrame(activeView.FocusMap); IMapFrame mapFrame = frameElement as IMapFrame; //根据MapSurround的uid,创建相应的MapSurroundFrame和MapSurround UID uid = new UIDClass(); uid.Value = "esriCarto.AlternatingScaleBar"; IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid, null); //设置MapSurroundFrame中比例尺的样式 IMapSurround mapSurround = mapSurroundFrame.MapSurround; IScaleBar markerScaleBar = ((IScaleBar)mapSurround); markerScaleBar.LabelPosition = esriVertPosEnum.esriBelow; markerScaleBar.UseMapSettings(); //QI,确定mapSurroundFrame的位置 IElement element = mapSurroundFrame as IElement; IEnvelope envelope = new EnvelopeClass(); envelope.PutCoords(startX, startY, startX + 10, startY + 10); element.Geometry = envelope; mapSurround = mapSurroundFrame.MapSurround; return(mapSurround); } catch (System.Exception ex) { return(null); } }
/// <summary> /// Occurs when this tool is created /// </summary> /// <param name="hook">Instance of the application</param> public override void OnCreate(object hook) { m_HookHelper.Hook = hook; m_PageLayOutControl = (IPageLayoutControlDefault)hook; // TODO: Add other initialization code }
private ITextElement pTitleElement; //图例标题的字体样式; #endregion Fields #region Constructors public frmLegendWizard(IMap pmap,IPageLayoutControlDefault pPageLayoutControl,IMapSurroundFrame pMapSurroundFrame) { //用于在 任意范围打印的对话框 中编辑图例 InitializeComponent(); mapSurroundFrame = pMapSurroundFrame; m_pageLayoutControl = pPageLayoutControl; m_Map = pmap; }
public TextChange(IPageLayoutControlDefault pageLayout, ITextElement textElement) { InitializeComponent(); pPageLayout = pageLayout; pTextElement = textElement; pTextSymbol = pTextElement.Symbol; pGraphicsContainer = pageLayout.ActiveView.GraphicsContainer; }
public frmPrintByAnyRegion(IMap pMap, IGeometry pGeometry, string txtTitle, string txtName, string txtProj, string txtTime, string textElevation, string textOtherInfo) //bool checkBLengend ,bool checkBNorthA ,bool checkBMapG ,bool checkBScaleB ,bool checkBText ) { InitializeComponent(); m_pageLayoutControl = this.axPageLayoutControl1.Object as IPageLayoutControlDefault; m_Map = pMap; m_Geometry = pGeometry; m_textTitle = txtTitle; //标题 m_textName = txtName; //制作人姓名 m_textProject = txtProj; //投影系统 m_textDate = txtTime; //时间 m_textElevation = textElevation; //高程系统 m_textOtherInfo = textOtherInfo; #region PageLayout的右键菜单 m_menuPageLayout = new ToolbarMenuClass(); m_menuPageLayout.AddItem(new ControlsPageZoomInToolClass(), 1, 0, false, esriCommandStyles.esriCommandStyleIconOnly); m_menuPageLayout.AddItem(new ControlsPageZoomOutToolClass(), 2, 1, false, esriCommandStyles.esriCommandStyleIconOnly); m_menuPageLayout.AddItem(new ControlsPagePanToolClass(), 3, 2, false, esriCommandStyles.esriCommandStyleIconOnly); m_menuPageLayout.AddItem(new ControlsPageZoomWholePageCommandClass(), 4, 3, false, esriCommandStyles.esriCommandStyleIconOnly); m_menuPageLayout.AddItem(new ControlsPageZoomOutFixedCommandClass(), 5, 4, false, esriCommandStyles.esriCommandStyleIconOnly); //Add PageLayOUTControl navigation commands. m_menuPageLayout.AddItem(new ControlsPageZoomPageToLastExtentBackCommandClass(), 6, 5, false, esriCommandStyles.esriCommandStyleIconOnly); m_menuPageLayout.AddItem(new ControlsPageZoomPageToLastExtentForwardCommandClass(), 7, 6, false, esriCommandStyles.esriCommandStyleIconOnly); m_menuPageLayout.SetHook(m_pageLayoutControl); #endregion this.axPageLayoutControl1.LoadMxFile(System.Windows.Forms.Application.StartupPath + @"\pagelayoutTemplate\海域图.mxt", Type.Missing); SetMapFrame(); //产生一个地图容器IMaps对象 IMaps maps = new Maps(); maps.Add(m_Map); m_pageLayoutControl.PageLayout.ReplaceMaps(maps); if (m_Map.MapUnits == esriUnits.esriUnknownUnits) { m_Map.MapUnits = esriUnits.esriMeters; m_Map.DistanceUnits = esriUnits.esriMeters; } m_mapScale = m_Map.MapScale; axPageLayoutControl1.ActiveView.Refresh(); axPageLayoutControl1.ActiveView.ShowScrollBars = true; InitializePrintPreviewDialog(); printDialog1 = new PrintDialog(); InitializePageSetupDialog(); }
//bool checkBLengend ,bool checkBNorthA ,bool checkBMapG ,bool checkBScaleB ,bool checkBText ) public frmPrintByAnyRegion(IMap pMap,IGeometry pGeometry,string txtTitle ,string txtName ,string txtProj ,string txtTime ,string textElevation,string textOtherInfo) { InitializeComponent(); m_pageLayoutControl = this.axPageLayoutControl1.Object as IPageLayoutControlDefault; m_Map = pMap; m_Geometry = pGeometry; m_textTitle = txtTitle;//���� m_textName = txtName;//���������� m_textProject = txtProj;//ͶӰϵͳ m_textDate = txtTime;//ʱ�� m_textElevation = textElevation;//�߳�ϵͳ m_textOtherInfo = textOtherInfo; #region PageLayout���Ҽ��˵� m_menuPageLayout = new ToolbarMenuClass(); m_menuPageLayout.AddItem(new ControlsPageZoomInToolClass(), 1, 0, false, esriCommandStyles.esriCommandStyleIconOnly); m_menuPageLayout.AddItem(new ControlsPageZoomOutToolClass(), 2, 1, false, esriCommandStyles.esriCommandStyleIconOnly); m_menuPageLayout.AddItem(new ControlsPagePanToolClass(), 3, 2, false, esriCommandStyles.esriCommandStyleIconOnly); m_menuPageLayout.AddItem(new ControlsPageZoomWholePageCommandClass(), 4, 3, false, esriCommandStyles.esriCommandStyleIconOnly); m_menuPageLayout.AddItem(new ControlsPageZoomOutFixedCommandClass(), 5, 4, false, esriCommandStyles.esriCommandStyleIconOnly); //Add PageLayOUTControl navigation commands. m_menuPageLayout.AddItem(new ControlsPageZoomPageToLastExtentBackCommandClass(), 6, 5, false, esriCommandStyles.esriCommandStyleIconOnly); m_menuPageLayout.AddItem(new ControlsPageZoomPageToLastExtentForwardCommandClass(), 7, 6, false, esriCommandStyles.esriCommandStyleIconOnly); m_menuPageLayout.SetHook(m_pageLayoutControl); #endregion this.axPageLayoutControl1.LoadMxFile(System.Windows.Forms.Application.StartupPath + @"\pagelayoutTemplate\����ͼ.mxt", Type.Missing); SetMapFrame(); //����һ����ͼ����IMaps���� IMaps maps = new Maps(); maps.Add(m_Map); m_pageLayoutControl.PageLayout.ReplaceMaps(maps); if (m_Map.MapUnits == esriUnits.esriUnknownUnits) { m_Map.MapUnits = esriUnits.esriMeters; m_Map.DistanceUnits = esriUnits.esriMeters; } m_mapScale = m_Map.MapScale; axPageLayoutControl1.ActiveView.Refresh(); axPageLayoutControl1.ActiveView.ShowScrollBars = true; InitializePrintPreviewDialog(); printDialog1 = new PrintDialog(); InitializePageSetupDialog(); }
//private IMapControlDefault m_MapControl; public frmPrint(IPageLayoutControlDefault page) { // // Required for Windows Form Designer support // InitializeComponent(); m_PageLayoutControl = page; // // TODO: Add any constructor code after InitializeComponent call // }
public ToolLib(frmMain frmMian) { m_frmMian = frmMian; m_mapControl = frmMian.MapControl; m_pageLayoutControl = frmMian.PageLayoutControl; m_sceneControl = frmMian.SceneControl; m_workSpace = frmMian.WorkSpace; m_gcon = frmMian.Gcon; m_connStr = frmMian.ConnectionString; m_statusBar = frmMian.StatusBar; m_activeView = frmMian.MapControl.ActiveView; }
/// <summary> /// bind the MapControl and PageLayoutControl together by assigning a new joint focus map /// </summary> /// <param name="mapControl"></param> /// <param name="pageLayoutControl"></param> /// <param name="activateMapFirst">true if the MapControl supposed to be activated first</param> public void BindControls(IMapControlDefault mapControl, IPageLayoutControlDefault 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); }
public FormMain() { InitializeComponent(); try { //初始化IMapControlDefault与IPageLayoutControlDefault接口变量 m_mapControl = axMapControl1.Object as IMapControlDefault; m_pageLayoutControl = axPageLayoutControl1.Object as IPageLayoutControlDefault; m_tocControl = axTOCControl1.Object as ITOCControlDefault; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 构造函数 /// </summary> public MainPage() { this.Presenter = new MainPagePresenters(this); InitializeComponent(); try { //初始化IMapControlDefault与IPageLayoutControlDefault接口变量 m_mapControl = axMapControl1.Object as IMapControlDefault; m_pageLayoutControl = axPageLayoutControl1.Object as IPageLayoutControlDefault; m_tocControl = axTOCControl1.Object as ITOCControlDefault; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 返回IMapSurroundFrame类型的元素 /// </summary> /// <param name="pageControl"></param> /// <param name="pageX"></param> /// <param name="pageY"></param> /// <returns></returns> public static IElement GetElementFromPage(IPageLayoutControlDefault pageControl, int pageX, int pageY) { try { pageControl.ActiveView.GraphicsContainer.Reset(); IElement element = pageControl.ActiveView.GraphicsContainer.Next(); while (element != null) { bool isHit = element.HitTest(pageX, pageY, 1); if (isHit) { return(element); } element = pageControl.ActiveView.GraphicsContainer.Next(); } return(null); } catch (System.Exception ex) { return(null); } }
private void frmMain_Load(object sender, EventArgs e) { m_MapControl = (IMapControlDefault)axMapControl1.Object; m_pagelayoutcontrol = (IPageLayoutControlDefault)axPageLayoutControl1.Object; m_toccontrol = (ITOCControlDefault)axTOCControl1.Object; m_controlsSynchronizer = new ControlsSynchronizer(m_MapControl, m_pagelayoutcontrol); m_controlsSynchronizer.BindControls(true); m_controlsSynchronizer.AddFrameworkControl(axTOCControl1.Object); if (!File.Exists(LayoutConfigName)) { dotNetBarManager1.SaveLayout(LayoutConfigName); } dotNetBarManager1.LoadLayout(LayoutConfigName); m_REcentFelesList = new RecnetFilesList(); m_REcentFelesList.ReadRegistryKey(); if (RecnetFilesList.arrRencentFilesList.Count != 0) { SetRecentFilesListMenuItem(); } else { meunItem_Recent.Enabled = false; } TOCControlContextMenu(); DisableControlInEditorToolBar(); }
public DesignPageLayout(IMapControlDefault mapcontrol,IPageLayoutControlDefault pagelayoutControl) { m_pagelayoutControl = pagelayoutControl; m_mapControl = mapcontrol; }
public ControlsSynchronizer(IMapControlDefault mapControl, IPageLayoutControlDefault pageLayoutControl) : this() { m_mapControl = mapControl; m_pageLayoutControl = pageLayoutControl; }
/// <summary> /// 获取一个地图制图元素 /// </summary> /// <param name="ipUID"></param> /// <param name="ipEnv"></param> /// <param name="sName"></param> /// <param name="ipLayoutCtrl"></param> /// <param name="ipStyle"></param> /// <returns></returns> public static IMapSurround CreateMapSurround(UID ipUID, IEnvelope ipEnv, string sName, IPageLayoutControlDefault ipLayoutCtrl, IMapSurround ipStyle) { try { IMapSurround ms = null; IMapFrame mf = ipLayoutCtrl.ActiveView.GraphicsContainer.FindFrame(ipLayoutCtrl.ActiveView.FocusMap) as IMapFrame; IMapSurroundFrame msf = mf.CreateSurroundFrame(ipUID, ipStyle); IElement ele = msf as IElement; ms = msf.MapSurround; ms.Name = sName; ele.Geometry = ipEnv; ipLayoutCtrl.ActiveView.GraphicsContainer.AddElement(ele, 0); ele.Geometry = ipEnv; //再加一句才能根据画出来的范围改变图例大小 ipLayoutCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, ele, null); return(ms); } catch (System.Exception ex) { return(null); } }
public ESRI.ArcGIS.Controls.IPageLayoutControlDefault GetIPageLayoutControl() { IPageLayoutControlDefault pagelayout = this.axPageLayoutControl1.Object as IPageLayoutControlDefault; return(pagelayout); }
private IWorkspace m_workSpace = null; //空间数据库的工作空间 #endregion Fields #region Constructors public frmMain() { InitializeComponent(); m_currentWin = this; //初始化地图控件对象 m_mapControl = this.mapCtlMain.Object as IMapControlDefault; m_pageLayoutControl = this.axPageLayoutControl1.Object as IPageLayoutControlDefault; m_tocControl = this.axTOCControl1.Object as ITOCControlDefault; m_sceneControl = this.axSceneControl1.Object as ISceneControlDefault; m_pageLayoutControl.ActiveView.ShowScrollBars = true; m_pageLayoutControl.ActiveView.ShowRulers = true; PageLayoutToolBarInit(); //PageLayout右键菜单 //同步类,使mapcontrol和pagelayoutcontrol中的数据保持一致 m_controlsSynchronizer = new ControlsSynchronizer(m_mapControl, m_pageLayoutControl); m_controlsSynchronizer.BindControls(true); m_controlsSynchronizer.AddFrameWorkControl(this.axTOCControl1.Object); //绑定地图控件 this.axTOCControl1.SetBuddyControl(this.mapCtlMain); m_fgdbPath = ConfigurationManager.AppSettings["FGDBPath"]; //连接数据库,返回工作空间 m_gcon = new GDBConenction(this.m_fgdbPath); m_workSpace = m_gcon.OpenSDEWorkspace(); m_SDEClick = false; m_gdata = new GDBData(m_workSpace); //获取关系数据库连接字符串 m_connectionString = ConfigurationManager.AppSettings["ConnectionString"]; //获取主界面进度条 m_statusBar = this.uiStatusBar1; //初始化工具类 m_toolLib = new ToolLib(m_currentWin); m_toolLib.CurrentControl = "map";//默认mapcontrol为出示当前控件 //打开关系数据库 m_oraConn = new OleDbConnection(m_connectionString); try { m_oraConn.Open(); m_oraCmd = m_oraConn.CreateCommand(); } catch(Exception ee) { MessageBox.Show(ee.Message); } }
public override void OnCreate(object hook) { m_HookHelper.Hook = hook; m_PageLayoutControl = (IPageLayoutControlDefault)hook; }
public PageRightBtnMenu(IPageLayoutControlDefault pageLayoutControl) { this.m_pageLayoutControl = pageLayoutControl; }
public DesignPageLayout(IPageLayoutControlDefault pagelayoutControl) { m_pagelayoutControl = pagelayoutControl; }
public DesignPageLayout(IMapControlDefault mapcontrol, IPageLayoutControlDefault pagelayoutControl) { m_pagelayoutControl = pagelayoutControl; m_mapControl = mapcontrol; }