Esempio n. 1
0
        private void btn_Sketch_Click(object sender, EventArgs e)
        {
            ICommand cmd = new ControlsEditingSketchToolClass();

            cmd.OnCreate(m_MapControl.Object);
            m_MapControl.CurrentTool = (ITool)cmd;
        }
Esempio n. 2
0
        private void 赋值ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayerFrm lf = new LayerFrm(m_mapControl);

            lf.ShowDialog();
            ILayer        pLayer        = lf.PLayer;
            IFeatureClass pFeatureClass = (pLayer as IFeatureLayer).FeatureClass;
            IDataset      pDataset      = pFeatureClass as IDataset;
            IEngineEditor pEngineEditor = new EngineEditorClass();

            //开始编辑
            pEngineEditor.StartEditing(pDataset.Workspace, axMapControl1.Map);
            //开始操作
            pEngineEditor.StartOperation();
            //设置目标图层
            IEngineEditLayers pEditLayer = pEngineEditor as IEngineEditLayers;

            pEditLayer.SetTargetLayer(pLayer as IFeatureLayer, 0);
            //设置当前任务
            pEngineEditor.CurrentTask = new Utilities.CalculatContourTask() as IEngineEditTask;
            //执行绘制操作
            ICommand pSketch = new ControlsEditingSketchToolClass();

            pSketch.OnCreate(axMapControl1.Object);
            //pSketch.OnClick();
            axMapControl1.CurrentTool = pSketch as ITool;
            if (pEngineEditor.EditState == esriEngineEditState.esriEngineStateEditing)
            {
                pEngineEditor.StopEditing(true);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 矢量“草图”工具
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void m_sketchtool_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (pEngineEditor.EditState == esriEngineEditState.esriEngineStateEditing)
     {
         ICommand t_sketchcommand = new ControlsEditingSketchToolClass();
         t_sketchcommand.OnCreate(m_mapControl.Object);
         m_mapControl.CurrentTool = t_sketchcommand as ITool;
         t_sketchcommand.OnClick();
     }
 }
Esempio n. 4
0
        private void cbx_EditTask_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = cbx_EditTask.SelectedIndex;

            switch (index)
            {
            case 0:
            {
                ClearCurrentTool();
                ICommand cmd = new ControlsEditingSketchToolClass();
                cmd.OnCreate(m_MapControl.Object);
                m_MapControl.CurrentTool = (ITool)cmd;
                break;
            }

            case 1:
            {
                ClearCurrentTool();
                TrimPolyline();
                break;
            }

            case 2:
            {
                ClearCurrentTool();
                CreateCircleFeature();
                break;
            }

            case 3:
            {
                ClearCurrentTool();
                CreateEnvelope();
                break;
            }

            default:
            {
                ClearCurrentTool();
                ICommand cmd = new ControlsEditingSketchToolClass();
                cmd.OnCreate(m_MapControl.Object);
                m_MapControl.CurrentTool = (ITool)cmd;
                break;
            }
            }
        }
Esempio n. 5
0
 private void addfeature()
 {
     ICommand pCommand;
     pCommand = new ControlsClearSelectionCommandClass();
     pCommand.OnCreate(axMapControl1.Object);
     pCommand.OnClick();
     pCommand = new ControlsEditingSketchToolClass();
     pCommand.OnCreate(axMapControl1.Object);
     axMapControl1.CurrentTool = pCommand as ITool;
 }