コード例 #1
0
ファイル: FormMapPrinter.cs プロジェクト: frankerlee/Yutai
        private void CreateESRICommand()
        {
            ICommand command = new ControlsMapDownCommandClass();

            this.m_esriCommandList.Add(command);
            command = new ControlsMapRefreshViewCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsMapLeftCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsMapRightCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsMapUpCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsMapRotateToolClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsPagePanToolClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsPageZoom100PercentCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsPageZoomInFixedCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsPageZoomInToolClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsPageZoomOutFixedCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsPageZoomOutToolClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsPageZoomPageToLastExtentBackCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsPageZoomPageToLastExtentForwardCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsPageZoomPageWidthCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsPageZoomWholePageCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsRotateElementToolClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsRotateLeftCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsRotateRightCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsSelectToolClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsSendBackwardCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsSendToBackCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsGroupCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsUngroupCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsMapClearMapRotationCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsBringForwardCommandClass();
            this.m_esriCommandList.Add(command);
            command = new ControlsBringToFrontCommandClass();
            this.m_esriCommandList.Add(command);
        }
コード例 #2
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("未启动编辑", "提示!"); }
            }
        }