Exemple #1
0
        private void Paste()
        {
            ICommand cmd = new ControlsEditingPasteCommandClass();

            cmd.OnCreate(m_MapControl);
            cmd.OnClick();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string layerName = comboBox1.Text;

            this.Close();

            int count = mMap.LayerCount;

            for (int i = 0; i < count; i++)
            {
                if (((IFeatureLayer)mMap.get_Layer(i)).FeatureClass.ShapeType == mLayerType && mMap.get_Layer(i).Name == layerName)
                {
                    ILayer        currentLayer = mMap.get_Layer(i);
                    IFeatureLayer featureLayer = currentLayer as IFeatureLayer;

                    ((IEngineEditLayers)mEngineEditor).SetTargetLayer(featureLayer, 0);
                    ICommand pCmd = new ControlsEditingPasteCommandClass();
                    pCmd.OnCreate(mMap.Object);
                    mMap.CurrentTool = pCmd as ITool;
                    pCmd.OnClick();
                    XtraMessageBox.Show("粘贴成功", "提示信息", MessageBoxButtons.OK);
                    return;
                }
            }
        }
Exemple #3
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("未启动编辑", "提示!"); }
            }
        }