private void but_head_Click(object sender, EventArgs e) { this.map_control.CurrentTool = null; ICommand pCommand = new ControlsMapPanTool(); pcommandTool(pCommand); }
private void pan_mapToolbarItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ICommand panTool = new ControlsMapPanTool(); panTool.OnCreate(m_mapControl.Object); m_mapControl.CurrentTool = panTool as ITool; }
private void pan_click(object sender, EventArgs e) { ICommand cmd = new ControlsMapPanTool(); cmd.OnCreate(this.mapControl.Object); this.mapControl.CurrentTool = cmd as ITool; }
//map移动 public static void MapPanTool(AxMapControl mapControl) { ICommand command1 = new ControlsMapPanTool(); command1.OnCreate(mapControl.Object); mapControl.CurrentTool = command1 as ITool; }
//漫游 private void Btn_Pan_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ICommand cmd = new ControlsMapPanTool(); cmd.OnCreate(axMapControl_1.Object); axMapControl_1.CurrentTool = cmd as ITool; }
//page移动 public static void PagePanTool(AxPageLayoutControl pageLayoutControl) { ICommand command1 = new ControlsMapPanTool(); command1.OnCreate(pageLayoutControl.Object); pageLayoutControl.CurrentTool = command1 as ITool; }
//漫游 private void BtnPan_Click_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { ICommand Cmd = new ControlsMapPanTool(); Cmd.OnCreate(this.axMapControl1.Object); this.axMapControl1.CurrentTool = Cmd as ITool; }
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(); } } }
/// <summary> /// 地图鼠标状态恢复到平移状态 /// </summary> private void MapMouseToDefault() { CommonLib.MapMouseFlag = 1; ICommand command = new ControlsMapPanTool(); command.OnCreate(axMapControlMainMap.Object); axMapControlMainMap.CurrentTool = command as ITool; }
//平移 private void ToolButtonPan_Click(object sender, EventArgs e) { ICommand pan = new ControlsMapPanTool(); pan.OnCreate(m_mapControl); m_mapControl.CurrentTool = pan as ITool; currentTool = CustomTool.None; }
private void Bbtn_pan_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Check(); Bbtn_pan.Down = true; ICommand Cmd = new ControlsMapPanTool(); Cmd.OnCreate(this.axMapControl1.Object); this.axMapControl1.CurrentTool = Cmd as ITool; axMapControl1.MousePointer = esriControlsMousePointer.esriPointerPan; }
private void LoadMap() { CmmRun.InitUniqueValueRenderer();//렌더러초기생성작업 //Buddy up controls //tocControl.SetBuddyControl(mapControl); toolbarControl.SetBuddyControl(mapControl); //add command and tools to the toolbar //toolbarControl.AddItem("esriControls.ControlsOpenDocCommand"); //toolbarControl.AddItem("esriControls.ControlsAddDataCommand"); //toolbarControl.AddItem("esriControls.ControlsSaveAsDocCommand"); toolbarControl.AddItem("esriControls.ControlsMapNavigationToolbar"); toolbarControl.AddItem("esriControls.ControlsMapIdentifyTool"); toolbarControl.AddItem("esriControls.ControlsMapMeasureTool"); toolbarControl.AddItem("esriControls.ControlsMapZoomToolControl"); toolbarControl.AddItem("esriControls.ControlsMapGoToCommand"); toolbarControl.AddItem("esriControls.ControlsGraphicElementToolbar"); //toolbarControl.AddItem("esriControls.ControlsFeatureSelectionToolbar");//피처선택모드 //Pan모드 선택처리 //FindCommandAndExecute((IApplication)mapControl.Parent, "esriControls.ControlsMapPanTool"); ICommand cmd = new ControlsMapPanTool(); cmd.OnCreate(mapControl.Object); if (cmd.Enabled) { mapControl.CurrentTool = (ITool)cmd; } //set controls' properties toolbarControl.BackColor = Color.FromArgb(245, 245, 220); //wire up events mapControl.OnMouseMove += new IMapControlEvents2_Ax_OnMouseMoveEventHandler(mapControl_OnMouseMove); //IUniqueValueRenderer renderer = (UniqueValueRenderer)GisCmm.uniqueValueRenderer; //layer.Renderer = renderer as IFeatureRenderer; //스케일확대 //mapControl.Extent = WTL_FLOW_PS.AreaOfInterest; //mapControl.Scale(10000f); //mapControl.ToMapPoint(GisCmm._ulsanCoords.X, GisCmm._ulsanCoords.Y ); //레이어명 적용 //tocControl.Update(); }
private void MapViewer_Load(object sender, EventArgs e) { //地图导航默认平移 ICommand command = null; command = new ControlsMapPanTool(); if (command != null) { command.OnCreate(AxMapControlMainMap.Object); if (command is ITool) { AxMapControlMainMap.CurrentTool = command as ITool; } else { command.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 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 }
private void pan_Click(object sender, EventArgs e) { zoomin.Checked = false; zoomout.Checked = false; findpath.Checked = false; startcalculating.Checked = false; select.Checked = false; distanceprocess.Checked = false; ICommand pcommand = new ControlsMapPanTool(); pcommand.OnCreate(axMapControl1.Object); axMapControl1.CurrentTool = pcommand as ITool; }
private void axCommandBars1_Execute(object sender, AxXtremeCommandBars._DCommandBarsEvents_ExecuteEvent e) { EngineFuntions.SetToolNull(); switch (e.control.Id) { //case ForAR.BusInfo_Help: // System.Diagnostics.Process.Start(Winapp.StartupPath + @"\用户手册.doc"); // break; //case ForAR.BusInfo_ParaSet: // System.Diagnostics.Process.Start(Winapp.StartupPath + @"\Businfo.ini"); // break; case ForAR.Map3D_ZoomIn: m_ToolStatus = ForAR.Map3D_ZoomIn; if (axMapControl1.Visible == true) { ICommand pCommand; pCommand = new ControlsMapZoomInTool(); pCommand.OnCreate(axMapControl1.Object); axMapControl1.CurrentTool = (ITool)pCommand; } break; case ForAR.Map3D_ZoomOut: m_ToolStatus = ForAR.Map3D_ZoomOut; if (axMapControl1.Visible == true) { ICommand pCommand; pCommand = new ControlsMapZoomOutTool(); pCommand.OnCreate(axMapControl1.Object); axMapControl1.CurrentTool = (ITool)pCommand; } break; case ForAR.Map3D_Pan: m_ToolStatus = ForAR.Map3D_Pan; if (axMapControl1.Visible == true) { ICommand pCommand; pCommand = new ControlsMapPanTool(); pCommand.OnCreate(axMapControl1.Object); axMapControl1.CurrentTool = (ITool)pCommand; } break; case ForAR.Map3D_Reflash: m_ToolStatus = ForAR.Map3D_Reflash; if (axMapControl1.Visible == true) { axMapControl1.Map.ClearSelection(); axMapControl1.ActiveView.GraphicsContainer.DeleteAllElements(); EngineFuntions.MapRefresh(); } break; //前一屏 case ForAR.Map3D_PreView: m_ToolStatus = ForAR.Map3D_PreView; if (axMapControl1.Visible == true) { EngineFuntions.GoBack(); } break; //后一屏 case ForAR.Map3D_NextView: m_ToolStatus = ForAR.Map3D_NextView; if (axMapControl1.Visible == true) { EngineFuntions.GoNext(); } break; case ForAR.Map3D_Distance: //计算长度 break; case ForAR.Map3D_Area: //计算面积 break; case ForAR.Map3D_Select: //拉框选择 m_ToolStatus = ForAR.Map3D_Select; axMapControl1.MousePointer = esriControlsMousePointer.esriPointerPencil; break; case ForAR.Map3D_PointSelect: //点击选择 m_ToolStatus = ForAR.Map3D_PointSelect; axMapControl1.MousePointer = esriControlsMousePointer.esriPointerPencil; break; case ForAR.Map3D_PolySelect: //多边形选择 m_ToolStatus = ForAR.Map3D_PolySelect; axMapControl1.MousePointer = esriControlsMousePointer.esriPointerPencil; break; case ForAR.Map3D_CircleSelect: //圆形选择 m_ToolStatus = ForAR.Map3D_CircleSelect; axMapControl1.MousePointer = esriControlsMousePointer.esriPointerPencil; break; case ForAR.Record_Input: //工程入库 m_ToolStatus = ForAR.Record_Input; axMapControl1.MousePointer = esriControlsMousePointer.esriPointerPencil; try { RegistryKey testKey = Registry.CurrentUser.OpenSubKey("TestKey"); if (testKey == null) { testKey = Registry.CurrentUser.CreateSubKey("TestKey"); testKey.SetValue("OpenFolderDir", ""); testKey.Close(); Registry.CurrentUser.Close(); } else { folderBrowserDialog1.SelectedPath = testKey.GetValue("OpenFolderDir").ToString(); testKey.Close(); Registry.CurrentUser.Close(); } } catch (Exception ee) { } if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { string folderName = folderBrowserDialog1.SelectedPath; m_frmArchivePane.m_FilePath.Clear(); m_frmArchivePane.m_strFolder = folderName; ForAR.FindFile(folderName + "\\", ref m_frmArchivePane.m_FilePath, folderName.LastIndexOf("\\") + 1); m_frmArchivePane.ReflashGrid(); axDockingPane1.FindPane(ForAR.Pan_Archive).Selected = true; RegistryKey testKey = Registry.CurrentUser.OpenSubKey("TestKey", true); //true表示可写,false表示只读 testKey.SetValue("OpenFolderDir", folderName); testKey.Close(); Registry.CurrentUser.Close(); } break; case ForAR.Map3D_Full: m_ToolStatus = ForAR.Map3D_Full; if (axMapControl1.Visible == true) { axMapControl1.Extent = axMapControl1.FullExtent; } break; default: break; } }
private void toolStripButton3_Click(object sender, EventArgs e) { ICommand pCommand = new ControlsMapPanTool(); switch (this.tabControl1.SelectedIndex) { case 0: pCommand.OnCreate(this.axMapControl1.Object); this.axMapControl1.CurrentTool = pCommand as ITool; break; case 1: pCommand.OnCreate(this.axPageLayoutControl1.Object); this.axPageLayoutControl1.CurrentTool = pCommand as ITool; break; } }
private void btnPan_Click(object sender, EventArgs e) { UncheckAllButtons(sender); var cmd = new ControlsMapPanTool(); cmd.OnCreate(axMapControl1.Object); axMapControl1.CurrentTool = (ITool)cmd; }
private void SaveInit(object sender) { this.operateMode = OperateMode.None; UncheckAllButtons(sender); var cmd = new ControlsMapPanTool(); cmd.OnCreate(axMapControl1.Object); axMapControl1.CurrentTool = (ITool)cmd; }