示例#1
0
        private void Delete()
        {
            ICommand cmd = new ControlsEditingClearCommandClass();

            cmd.OnCreate(m_MapControl);
            cmd.OnClick();
        }
 //删除要素
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         pMapControl.MousePointer = esriControlsMousePointer.esriPointerArrow;
         ICommand m_delFeatCom = new ControlsEditingClearCommandClass();
         m_delFeatCom.OnCreate(pMapControl.Object);
         m_delFeatCom.OnClick();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         LogHelper.WriteLog(typeof(Form_Editor), ex, "删除要素");
     }
 }
示例#3
0
 private void Delet_feature_Click(object sender, EventArgs e)
 {
     ICommand pCommand = new ControlsEditingClearCommandClass();
     pCommand.OnCreate(axMapControl1.Object);
     pCommand.OnClick();
 }
示例#4
0
        private void ExecuteDevCommand(object sender)
        {
            if (sender == null)
            {
                return;
            }
            DevComponents.DotNetBar.BaseItem vItem = sender as DevComponents.DotNetBar.BaseItem;
            string strToolStripName = vItem.Name.ToLower();

            ESRI.ArcGIS.SystemUI.ICommand pCommand = null;

            switch (strToolStripName)
            {
            case "bttdefaulttool":
                pCommand = new Tools.ControlsDefaultTool();
                break;

            case "bttselection":    //打开文档
                pCommand = new ControlsSelectFeaturesToolClass();
                break;

            case "bttclearselection":
                pCommand = new ControlsClearSelectionCommandClass();
                break;

            case "bttzoomintool":
                pCommand = new ControlsMapZoomInToolClass();
                break;

            case "bttzoomouttool":
                pCommand = new ControlsMapZoomOutToolClass();
                break;

            case "bttpantool":
                pCommand = new ControlsMapPanToolClass();
                break;

            case "bttzoominfixedcommand":
                pCommand = new ControlsMapZoomInFixedCommandClass();
                break;

            case "bttzoomoutfixedcommand":
                pCommand = new ControlsMapZoomOutFixedCommandClass();
                break;

            case "bttrefreshviewcommand":
                pCommand = new ControlsMapRefreshViewCommandClass();
                break;

            case "bttfullextentcommand":
                pCommand = new ControlsMapFullExtentCommandClass();
                break;

            case "bttzoomtolastextentbackcommand":
                pCommand = new ControlsMapZoomToLastExtentBackCommandClass();
                break;

            case "bttzoomtolastextentforwardcommand":
                pCommand = new ControlsMapZoomToLastExtentForwardCommandClass();
                break;

            case "bttstartedit":
                if (CreateShape.m_CurrentLayer != null)
                {
                    pCommand = new Command.ControlsStartEditCommand();
                }
                break;

            case "bttsaveedit":
                if (CreateShape.m_CurrentLayer != null)
                {
                    pCommand = new Command.ControlsSaveEditCommand(axMapControl1);
                }
                break;

            case "bttstopedit":
                if (CreateShape.m_CurrentLayer != null)
                {
                    axMapControl1.CurrentTool  = null;
                    axMapControl1.MousePointer = esriControlsMousePointer.esriPointerDefault;
                    pCommand = new Command.ControlsStopEditCommand(axMapControl1);
                }
                break;

            case "buttsketchup":
                if (CreateShape.m_CurrentLayer != null && CreateShape.pWorkspaceEdit != null)
                {
                    if (CreateShape.pWorkspaceEdit.IsBeingEdited())
                    {
                        axMapControl1.CurrentTool = null;
                        pCommand = new Tools.SketChupTool(axMapControl1);
                    }
                }
                break;

            case "bttnundo":
                if (CreateShape.m_CurrentLayer != null && CreateShape.pWorkspaceEdit != null)
                {
                    if (CreateShape.pWorkspaceEdit.IsBeingEdited())
                    {
                        pCommand = new Command.ControlsUndoEditCommand(axMapControl1);
                    }
                }
                break;

            case "bttnredo":
                if (CreateShape.m_CurrentLayer != null && CreateShape.pWorkspaceEdit != null)
                {
                    if (CreateShape.pWorkspaceEdit.IsBeingEdited())
                    {
                        pCommand = new Command.ControlsRedoEditCommand(axMapControl1);
                    }
                }
                break;

            case "bttndelete":
                if (CreateShape.m_CurrentLayer != null && CreateShape.pWorkspaceEdit != null)
                {
                    if (CreateShape.pWorkspaceEdit.IsBeingEdited())
                    {
                        pCommand = new Command.ControlsDeleteSelectedFeaturesCommand(axMapControl1);
                    }
                }
                break;

            case "bttadddata":
                pCommand = new Command.ControlsAddDataCommand(axMapControl1);
                break;

            case "bttopendoc":
                pCommand = new Command.ControlsOpenMxdDocCommand(axMapControl1);
                break;

            case "bttsave":
                pCommand = new Command.ControlsSaveMxdDocCommand();
                break;

            case "bttsaveas":
                pCommand = new Command.ControlsSaveasMxdDocCommand();
                break;

            case "bttcut":
                pCommand = new ControlsEditingCutCommandClass();
                break;

            case "bttcopy":
                pCommand = new ControlsEditingCopyCommandClass();
                break;

            case "bttpast":
                pCommand = new ControlsEditingPasteCommandClass();
                break;

            case "bttdelete":
                pCommand = new ControlsEditingClearCommandClass();
                break;

            case "bttexitmxddoc":
                pCommand = new Command.ControlsExitMxdDocCommand(this);
                break;
            }
            if (pCommand == null)
            {
                return;
            }
            pCommand.OnCreate(this.axMapControl1.Object);
            if (pCommand is ITool)
            {
                this.axMapControl1.CurrentTool = pCommand as ITool;
            }
            else
            {
                try
                {
                    pCommand.OnClick();
                }
                catch { MessageBox.Show("未启动编辑", "提示!"); }
            }
        }