//全图显示 private void Btn_ViewEntire_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ICommand full = new ControlsMapFullExtentCommand(); full.OnCreate(axMapControl_1.Object); full.OnClick(); }
//全图 private void BtnViewAll_Click_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ICommand Cmd = new ControlsMapFullExtentCommand(); Cmd.OnCreate(this.axMapControl1.Object); Cmd.OnClick(); }
private void mxd_open_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = initPath; ofd.Filter = "Map Document|*.mxd||*.*"; ofd.RestoreDirectory = true; ofd.FilterIndex = 1; if (ofd.ShowDialog() == DialogResult.OK) { IMapControlDefault pMCD; //定义一个接口 pMCD = axMapControl1.Object as IMapControlDefault; //向上转型,实现接口的方法 string strFileName = ofd.FileName; bool bRet = pMCD.CheckMxFile(strFileName); if (bRet) { pMCD.LoadMxFile(strFileName, null, Type.Missing); ICommand Cmd = new ControlsMapFullExtentCommand(); Cmd.OnCreate(this.axMapControl1.Object); Cmd.OnClick(); } pMCD = axMapControl2.Object as IMapControlDefault; if (bRet) { pMCD.LoadMxFile(strFileName, null, Type.Missing); ICommand Cmd = new ControlsMapFullExtentCommand(); Cmd.OnCreate(this.axMapControl2.Object); Cmd.OnClick(); } } }
private void fullExtent_mapToolbarItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ICommand fullExtentTool = new ControlsMapFullExtentCommand(); fullExtentTool.OnCreate(m_mapControl.Object); fullExtentTool.OnClick(); }
private void fullExtend_click(object sender, EventArgs e) { ICommand cmd = new ControlsMapFullExtentCommand(); cmd.OnCreate(this.mapControl.Object); cmd.OnClick(); }
private void bubbleBarNavigationBtn_Click(object sender, EventArgs e)//主地图地图导航条:Click { CommonLib.MapMouseFlag = 1; SimpleButton button = sender as SimpleButton; ICommand command = null; switch (button.Name) { case "bubbleButtonFullExtent": command = new ControlsMapFullExtentCommand(); break; //全屏 case "bubbleButtonZoomIn": command = new ControlsMapZoomInTool(); break; //放大 case "bubbleButtonZoomOut": command = new ControlsMapZoomOutTool(); break; //缩小 case "bubbleButtonPan": command = new ControlsMapPanTool(); break; //平移 case "bubbleButtonPreView": command = new ControlsMapZoomToLastExtentBackCommand(); break; //上一视图 case "bubbleButtonNextView": command = new ControlsMapZoomToLastExtentForwardCommand(); break; //下一视图 default: axMapControlMainMap.CurrentTool = null; CommonLib.MapMouseFlag = 10; _effectLayer.SwipeLayer = _toccSelectedLayer; if (button.Name == "bubbleButtonLenMeasure") { CommonLib.MapMouseFlag = 8; } else if (button.Name == "bubbleButtonAreaMeasure") { CommonLib.MapMouseFlag = 9; } else if (button.Name == "bubbleButtonIdentify") { command = new ControlsMapIdentifyTool(); } else if (button.Name == "bubbleButtonSwipe") { command = new ControlsMapSwipeToolClass(); } else if (button.Name == "bubbleButtonSelection") { command = new ControlsSelectFeaturesToolClass(); } break; } if (command != null) { command.OnCreate(axMapControlMainMap.Object); if (command is ITool tool) { axMapControlMainMap.CurrentTool = tool; } else { command.OnClick(); } } }
private void Form1_Load(object sender, EventArgs e) { int index = Environment.CurrentDirectory.IndexOf(@"\bin"); initPath = Environment.CurrentDirectory.Substring(0, index); //加载地图(相对路径) axMapControl1.LoadMxFile(initPath + @"\map\biye.mxd"); ICommand Cmd = new ControlsMapFullExtentCommand(); Cmd.OnCreate(this.axMapControl1.Object); Cmd.OnClick(); //加载鹰眼图(相对路径) axMapControl2.LoadMxFile(initPath + @"\map\biye.mxd"); ICommand Cmd1 = new ControlsMapFullExtentCommand(); Cmd1.OnCreate(this.axMapControl2.Object); Cmd1.OnClick(); }
/// <summary> /// 根据<see cref="EMapTools"/>枚举创建ArcGIS的命令 /// </summary> /// <param name="eTool"></param> /// <returns></returns> public static ICommand CreateCommand(EMapTools eTool) { ICommand command = null; switch (eTool) { case EMapTools.FullExtent: command = new ControlsMapFullExtentCommand(); break; case EMapTools.ZoomIn: command = new ControlsMapZoomInTool(); break; case EMapTools.ZoomOut: command = new ControlsMapZoomOutTool(); break; case EMapTools.Pan: command = new ControlsMapPanTool(); break; case EMapTools.PreView: command = new ControlsMapZoomToLastExtentBackCommand(); break; case EMapTools.Identify: command = new ControlsMapIdentifyTool(); break; case EMapTools.Selection: command = new ControlsSelectFeaturesToolClass(); break; case EMapTools.Swipe: command = new ControlsMapSwipeToolClass(); break; } return(command); }
//打开 private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = "D:\\大连矢量化\\"; ofd.Filter = "Map Document|*.mxd"; ofd.RestoreDirectory = true; ofd.FilterIndex = 1; if (ofd.ShowDialog() == DialogResult.OK) { IMapControlDefault pMCD; pMCD = axMapControl1.Object as IMapControlDefault; string strFileName = ofd.FileName; bool bRet = pMCD.CheckMxFile(strFileName); if (bRet) { pMCD.LoadMxFile(strFileName, null, Type.Missing); axMapEve.LoadMxFile(strFileName); ICommand Cmd = new ControlsMapFullExtentCommand(); Cmd.OnCreate(this.axMapEve.Object); Cmd.OnClick(); } } }
private void barBtnSelectElement_ItemClick(object sender, ItemClickEventArgs e) { #region 方法一:利用arcgis的command CommonLib.MapMouseFlag = 1; BarButtonItem barBtn = e.Item as BarButtonItem; ICommand command = null; switch (barBtn.Name) { //case "BtnItemPoint": //指针(SelectElment) // command = new ESRI.ArcGIS.Controls.ControlsPa // break; case "barBtnFullExtent": //全屏 command = new ControlsMapFullExtentCommand(); break; case "barBtnZoomIn": //放大 command = new ControlsMapZoomInTool(); break; case "barBtnZoomOut": //缩小 command = new ControlsMapZoomOutTool(); break; case "barBtnPan": //平移 command = new ControlsMapPanTool(); break; case "barBtnPreView": //上一视图 command = new ControlsMapZoomToLastExtentBackCommand(); break; case "barBtnNextView": //下一视图 command = new ControlsMapZoomToLastExtentForwardCommand(); break; case "barBtnIdentify": //属性查看 command = new ControlsMapIdentifyTool(); break; case "barBtnSelectFeature": //选择 command = new ControlsGlobeSelectFeaturesTool(); break; case "barBtnClearSelection": //清空 command = new ControlsClearSelectionCommand(); break; case "barBtnZoomToTarget": //坐标跳转 command = new ControlsMapGoToCommand(); break; default: break; } if (command != null) { command.OnCreate(AxMapControlMainMap.Object); if (command is ITool) { AxMapControlMainMap.CurrentTool = command as ITool; } else { command.OnClick(); } } #endregion #region 方法二:先建立一个ArcGIS的ToolbarControl控件,将相应功能添加进去,然后模拟鼠标点击调用该功能 //DevComponents.DotNetBar.BubbleButton button = sender as DevComponents.DotNetBar.BubbleButton; //ESRI.ArcGIS.SystemUI.ICommand command = null; //command = axToolbarControl1.CommandPool.get_Command(1); //模拟ToolbarControl控件的第一按钮被点击 //command.OnClick(); #endregion }