예제 #1
0
        private void FullExtend()
        {
            ICommand c = new ControlsMapFullExtentCommandClass();

            c.OnCreate(axMapControl1.Object);
            c.OnClick();
        }
예제 #2
0
        /// <summary>
        /// ToolControl中增加控件
        /// </summary>
        /// <param name="axToolbarControl">ToolControl控件引用</param>
        /// <returns>正常:“”;异常:异常字符串</returns>
        public SystemErrorType UIToolControlAddItemFix(ref AxToolbarControl axToolbarControl)
        {
            try
            {
                //添加控件中的item by UID
                UID uIDZoomInC = new UIDClass();
                uIDZoomInC.Value = "esriControlCommands.ControlsMapZoomInFixedCommand";
                axToolbarControl.AddItem(uIDZoomInC, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
                UID uIDZoomOutC = new UIDClass();
                uIDZoomOutC.Value = "esriControlCommands.ControlsMapZoomOutFixedCommand";
                axToolbarControl.AddItem(uIDZoomOutC, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);

                //添加控件中的item by progID; up down left right
                string UPprogID = "esriControlCommands.ControlsMapUpCommand";
                axToolbarControl.AddItem(UPprogID, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
                string DownprogID = "esriControlCommands.ControlsMapDownCommand";
                axToolbarControl.AddItem(DownprogID, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
                axToolbarControl.AddItem("esriControlCommands.ControlsMapLeftCommand");
                axToolbarControl.AddItem("esriControlCommands.ControlsMapRightCommand");

                //添加控件中的item by ICommand : zoomIn,ZoomOut,Gobal,Walk
                axToolbarControl.AddItem(new ControlsMapZoomInTool());
                axToolbarControl.AddItem(new ControlsMapZoomOutTool());
                ICommand command = new ControlsMapFullExtentCommandClass();
                axToolbarControl.AddItem(command, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);
                axToolbarControl.AddItem(new ControlsMapPanTool());
            } catch (Exception)
            {
                return(SystemErrorType.enumArcObjectHandleError);
            }
            return(SystemErrorType.enumOK);
        }
예제 #3
0
        private void frmMagnifierWindows_Load(object sender, EventArgs e)
        {
            this.cboMapScale.SelectedIndexChanged += new EventHandler(this.cboMapScale_SelectedIndexChanged);
            ICommand command = new ControlsMapZoomInFixedCommandClass();

            command.OnCreate(this.axMapControl1.Object);
            this.btnFixedZoomIn.Tag = command;
            command = new ControlsMapZoomOutFixedCommandClass();
            command.OnCreate(this.axMapControl1.Object);
            this.btnFixedZoomOut.Tag = command;
            command = new ControlsMapFullExtentCommandClass();
            command.OnCreate(this.axMapControl1.Object);
            this.btnFullExtend.Tag = command;
            command = new ControlsMapZoomToLastExtentBackCommandClass();
            command.OnCreate(this.axMapControl1.Object);
            this.btnLastExtend.Tag = command;
            command = new ControlsMapZoomToLastExtentForwardCommandClass();
            command.OnCreate(this.axMapControl1.Object);
            this.btnNextExtend.Tag = command;
            base.MouseUp          += new MouseEventHandler(this.frmMagnifierWindows_MouseUp);
            base.Move += new EventHandler(this.frmMagnifierWindows_Move);
            MapHelper.CopyMap(this.m_pMap, this.axMapControl1.Map, false, false);
            if (this.m_proprty.m_ZoomType == ZoomType.FixedScale)
            {
                this.cboMapScale.Enabled = this.m_pMap.MapUnits != esriUnits.esriUnknownUnits;
            }
            else
            {
                this.cboMapScale.Enabled = true;
            }
        }
예제 #4
0
        private void barButtonItem8_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ICommand pCommand = new ControlsMapFullExtentCommandClass();

            pCommand.OnCreate(this.mainMapControl.Object);
            pCommand.OnClick();
        }
예제 #5
0
        private void Full()
        {
            var tool = new ControlsMapFullExtentCommandClass();

            tool.OnCreate(this.axMapControl1.Object);
            tool.OnClick();
        }
예제 #6
0
        private void barButtonFullExtent_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ControlsMapFullExtentCommandClass tool = new ControlsMapFullExtentCommandClass();

            tool.OnCreate(this.MapControl.Object);
            tool.OnClick();
        }
        private void cmd_FullExtend(object sender, EventArgs e)
        {
            ICommand c = new ControlsMapFullExtentCommandClass();

            c.OnCreate(m_MapControl);
            c.OnClick();
        }
예제 #8
0
파일: Form1.cs 프로젝트: Flame-c/CYHGIS
        private void ToolStripButton_ZoomFit_Click(object sender, EventArgs e)
        {//调用全图命令实现地图全图显示
            ICommand pFullExtent = new ControlsMapFullExtentCommandClass();

            pFullExtent.OnCreate(axMapControl1.Object);
            pFullExtent.OnClick();
        }
예제 #9
0
        private void tsbFullExtent_Click(object sender, EventArgs e)
        {
            ICommand pCmd = new ControlsMapFullExtentCommandClass();

            pCmd.OnCreate(MapMain.Object);
            pCmd.OnClick();
        }
예제 #10
0
파일: baseOrder.cs 프로젝트: hehao1999/GIS
        public static void full_view()
        {
            mainForm.mainform.mainMapControl.CurrentTool = null;
            ICommand pFullExtent = new ControlsMapFullExtentCommandClass();

            pFullExtent.OnCreate(mainForm.mainform.mainMapControl.Object);
            pFullExtent.OnClick();
        }
예제 #11
0
파일: MainForm.cs 프로젝트: xcpxr/RareGIS
        private void menuFullExtent_Click(object sender, EventArgs e)
        {
            //初始化FullExtent对象
            ICommand cmd = new ControlsMapFullExtentCommandClass();

            //FullExtent 与MapControls关联
            cmd.OnCreate(this.axMapControl1.Object);
            cmd.OnClick();
        }
예제 #12
0
파일: Menu.cs 프로젝트: AgentWord/SiPing
        public override void OnClick()
        {
            ILayer   layer = (ILayer)m_mapControl.CustomProperty;
            ICommand pCommand;

            pCommand = new ControlsMapFullExtentCommandClass();
            pCommand.OnCreate(m_mapControl.Object);
            pCommand.OnClick();
        }
예제 #13
0
파일: ToolBox.cs 프로젝트: AnuoF/MapFrame
        /// <summary>
        /// 全图显示
        /// </summary>
        public void FullView()
        {
            ICommand cmd = new ControlsMapFullExtentCommandClass();

            cmd.OnCreate(mapControl.Object);
            if (cmd.Enabled)
            {
                cmd.OnClick();
            }
        }
예제 #14
0
        private void toolStripButton5_Click(object sender, EventArgs e)
        {
            bCreateOrNot = false;
            axMapControl1.CurrentTool = null;
            ICommand command = new ControlsMapFullExtentCommandClass();

            command.OnCreate(axMapControl1.Object);
            axMapControl1.CurrentTool   = (ITool)command;
            this.tsbStartCreate.Enabled = true;
        }
예제 #15
0
        private void buttonItem8_Click(object sender, EventArgs e)
        {
            UID uID = new UIDClass();

            uID.Value = "esriControls.ControlsMapFullExtentCommand";
            ICommand cmd = this.m_cpool.FindByUID(uID);

            if (cmd == null)
            {
                cmd = new ControlsMapFullExtentCommandClass();
                ICommandPoolEdit pool = this.m_cpool as ICommandPoolEdit;
                pool.AddCommand(cmd, uID);
                pool.CallOnCreate(cmd);
            }
            cmd.OnClick();
        }
예제 #16
0
 /// <summary>
 /// 全图工具
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ZoomFulltoolStripButton3_Click(object sender, EventArgs e)
 {
     //当选中为数据视图时
     if (tabControl1.SelectedIndex == 0)
     {
         ICommand pCommand = new ControlsMapFullExtentCommandClass();
         ITool    pTool    = pCommand as ITool;
         pCommand.OnCreate(this.axMapControl1.Object);
         this.axMapControl1.CurrentTool = pTool;
         pCommand.OnClick();
     }
     //当选中为布局视图时
     if (tabControl1.SelectedIndex == 1)
     {
         ICommand pCommand = new ControlsMapFullExtentCommandClass();
         ITool    pTool    = pCommand as ITool;
         pCommand.OnCreate(this.axPageLayoutControl1.Object);
         this.axPageLayoutControl1.CurrentTool = pTool;
         pCommand.OnClick();
     }
 }
예제 #17
0
파일: frm_Main.cs 프로젝트: 2018wz/ArcGis-
        ILayerEffectProperties pEffectLayer = new CommandsEnvironmentClass();//注意需要将此代码定义为全局变量。
        private void 卷帘ToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            if (isJuanlianOrNot == 0)
            {
                卷帘ToolStripMenuItem.Checked = true;
                //barButtonItem1.Hint = "卷帘工具";
                ILayer pSwipeLayer = axMapControl1.get_Layer(0);     //获得卷帘图层
                pEffectLayer.SwipeLayer = pSwipeLayer;               //设置卷帘图层
                ICommand pCommand = new ControlsMapSwipeToolClass(); //调用卷帘工具
                pCommand.OnCreate(this.axMapControl1.Object);        //绑定工具
                this.axMapControl1.CurrentTool = pCommand as ITool;

                isJuanlianOrNot = 1;
            }
            else
            {
                卷帘ToolStripMenuItem.Checked = false;
                isJuanlianOrNot             = 0;
                ICommand pCommand = new ControlsMapFullExtentCommandClass();
                pCommand.OnCreate(this.axMapControl1.Object);
                this.axMapControl1.CurrentTool = pCommand as ITool;
            }
        }
예제 #18
0
        public void TextToPoint(string fieldName,string type)
        {
            if (m_FeatureLayer.FeatureClass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint)
            {
                MessageBox.Show("��ȷ��չ��ĵ�һ��ͼ��Ϊ��ͼ��", "��ʾ��Ϣ", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                return;
            }
            OpenFileDialog openfileDialog = new OpenFileDialog();
            openfileDialog.Title = "��ѡ��չ���ͼ��������ļ�";
            openfileDialog.Filter = " txt files(*.txt)|*.txt|All files(*.*)|*.*";
            openfileDialog.RestoreDirectory = true;
            if (openfileDialog.ShowDialog() == DialogResult.OK)
            {

                frmW.WaitingLabel = "�����������...";
                frmW.Show();
                Application.DoEvents();
                frmW.WaitingLabel = "����ֶ�...";
                Application.DoEvents();
                IFeatureClass pFeaCls = m_FeatureLayer.FeatureClass;
                IField field=new FieldClass();
                IFieldEdit fieldEdit = field as IFieldEdit;
                fieldEdit.Name_2 = fieldName;
                //pFieldEdit.Type_2 = esriFieldType.esriFieldTypeDouble;
                switch (type)
                {
                    case "string":
                        fieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
                        break;
                    case"double":
                        fieldEdit.Type_2 = esriFieldType.esriFieldTypeDouble;
                        break;
                };
                pFeaCls.AddField(fieldEdit);

                LocalFilePath = openfileDialog.FileName;
                StreamReader strRead = new StreamReader(LocalFilePath);
                IList<string> liusu=new List<string>();
                frmW.WaitingLabel = "��������...";
                Application.DoEvents();
                string line;
                line = strRead.ReadLine();
                while (line != null)
                {
                    liusu.Add(line);
                    line = strRead.ReadLine();
                }

                //StreamReader strRead = new StreamReader(LocalFilePath);

                string[] pSeparate;
                IPoint pPoint = new PointClass();
                double liusuValue;
                for (int i = 0; i < liusu.Count; i++)
                {
                    frmW.WaitingLabel = "���ڻ��Ƶ� " + i.ToString() + " ����";
                    Application.DoEvents();
                    pSeparate = liusu[i].Split(',');
                    pPoint.X = double.Parse(pSeparate[0].Trim());
                    pPoint.Y = double.Parse(pSeparate[1].Trim());
                    liusuValue = double.Parse(pSeparate[2].Trim());
                    IFeature pFeature = pFeaCls.CreateFeature();
                    pFeature.Shape = pPoint as IGeometry;
                    pFeature.set_Value(pFeature.Fields.FindField(fieldName), liusuValue);
                    pFeature.Store();

                }
                m_mapControl.ActiveView.Refresh();
                frmW.Close();
                MessageBox.Show("������ɣ�");

            }
            ICommand pCommand = new ControlsMapFullExtentCommandClass();
            pCommand.OnCreate(m_mapControl.Object);
            pCommand.OnClick();
            m_statusBar.Panels[0].ProgressBarValue = 0;
        }
예제 #19
0
파일: GMap.cs 프로젝트: truonghinh/TnX
 void IGMap.FullExtent()
 {
     ICommand command = new ControlsMapFullExtentCommandClass();
     command.OnCreate(this._hook);
     command.OnClick();
 }
예제 #20
0
        /// <summary>
        /// 坐标文件展绘点图层
        /// </summary>
        public void TextToPoint()
        {
            if (m_FeatureLayer.FeatureClass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint)
            {
                MessageBox.Show("请确定展绘的第一个图层为点图层", "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                return;
            }
            OpenFileDialog openfileDialog = new OpenFileDialog();

            openfileDialog.Title            = "请选择展绘点图层的坐标文件";
            openfileDialog.Filter           = " txt files(*.txt)|*.txt|All files(*.*)|*.*";
            openfileDialog.RestoreDirectory = true;
            if (openfileDialog.ShowDialog() == DialogResult.OK)
            {
                frmW.WaitingLabel = "正在启动绘制...";
                frmW.Show();
                Application.DoEvents();
                LocalFilePath = openfileDialog.FileName;
                StreamReader strReadToEnd = new StreamReader(LocalFilePath);
                string       sAllLine     = strReadToEnd.ReadToEnd();
                int          LineCount    = sAllLine.Split('\n').Length + 1;
                string[]     pline        = new string[LineCount];
                double[]     x            = new double[LineCount];
                double[]     y            = new double[LineCount];
                string[]     pSeparate    = new string[] { };



                //m_statusBar.Panels[0].ProgressBarMinValue = 0;
                //m_statusBar.Panels[0].ProgressBarMaxValue = LineCount - 1;

                StreamReader strRead = new StreamReader(LocalFilePath);
                int          i       = 0;
                int          j       = 0;
                try
                {
                    if (strRead != null)
                    {
                        pline[i] = strRead.ReadLine();
                        while (pline[i] != null)
                        {
                            pSeparate = pline[i].Split(',', ' ', ';');
                            if (pSeparate.Length >= 3)
                            {
                                x[j] = double.Parse(pSeparate[1]);
                                y[j] = double.Parse(pSeparate[2]);
                                IFeatureClass pFeaCls  = m_FeatureLayer.FeatureClass;
                                IFeature      pFeature = pFeaCls.CreateFeature();
                                IPoint        pPoint   = new PointClass();
                                pPoint.X       = x[j];
                                pPoint.Y       = y[j];
                                pFeature.Shape = pPoint as IGeometry;
                                pFeature.Store();
                                m_mapControl.ActiveView.Refresh();
                                j++;
                                i++;
                                pline[i] = strRead.ReadLine();
                            }
                            else
                            {
                                i++;
                                pline[i] = strRead.ReadLine();
                            }
                            m_statusBar.Panels[0].ProgressBarValue = i;
                            frmW.WaitingLabel = "正在绘制第 " + i.ToString() + " 坐标";
                            Application.DoEvents();
                        }
                    }
                    frmW.Close();
                    MessageBox.Show("绘制完成!");
                }
                catch
                {
                    MessageBox.Show("请检查文本文件的第" + i + "行", "错误信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                }
            }
            ICommand pCommand = new ControlsMapFullExtentCommandClass();

            pCommand.OnCreate(m_mapControl.Object);
            pCommand.OnClick();
            m_statusBar.Panels[0].ProgressBarValue = 0;
        }
예제 #21
0
        public void TextToPoint(string fieldName, string type)
        {
            if (m_FeatureLayer.FeatureClass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint)
            {
                MessageBox.Show("请确定展绘的第一个图层为点图层", "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                return;
            }
            OpenFileDialog openfileDialog = new OpenFileDialog();

            openfileDialog.Title            = "请选择展绘点图层的坐标文件";
            openfileDialog.Filter           = " txt files(*.txt)|*.txt|All files(*.*)|*.*";
            openfileDialog.RestoreDirectory = true;
            if (openfileDialog.ShowDialog() == DialogResult.OK)
            {
                frmW.WaitingLabel = "正在启动绘制...";
                frmW.Show();
                Application.DoEvents();
                frmW.WaitingLabel = "添加字段...";
                Application.DoEvents();
                IFeatureClass pFeaCls   = m_FeatureLayer.FeatureClass;
                IField        field     = new FieldClass();
                IFieldEdit    fieldEdit = field as IFieldEdit;
                fieldEdit.Name_2 = fieldName;
                //pFieldEdit.Type_2 = esriFieldType.esriFieldTypeDouble;
                switch (type)
                {
                case "string":
                    fieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
                    break;

                case "double":
                    fieldEdit.Type_2 = esriFieldType.esriFieldTypeDouble;
                    break;
                }
                ;
                pFeaCls.AddField(fieldEdit);


                LocalFilePath = openfileDialog.FileName;
                StreamReader   strRead = new StreamReader(LocalFilePath);
                IList <string> liusu   = new List <string>();
                frmW.WaitingLabel = "读入数据...";
                Application.DoEvents();
                string line;
                line = strRead.ReadLine();
                while (line != null)
                {
                    liusu.Add(line);
                    line = strRead.ReadLine();
                }

                //StreamReader strRead = new StreamReader(LocalFilePath);

                string[] pSeparate;
                IPoint   pPoint = new PointClass();
                double   liusuValue;
                for (int i = 0; i < liusu.Count; i++)
                {
                    frmW.WaitingLabel = "正在绘制第 " + i.ToString() + " 坐标";
                    Application.DoEvents();
                    pSeparate  = liusu[i].Split(',');
                    pPoint.X   = double.Parse(pSeparate[0].Trim());
                    pPoint.Y   = double.Parse(pSeparate[1].Trim());
                    liusuValue = double.Parse(pSeparate[2].Trim());
                    IFeature pFeature = pFeaCls.CreateFeature();
                    pFeature.Shape = pPoint as IGeometry;
                    pFeature.set_Value(pFeature.Fields.FindField(fieldName), liusuValue);
                    pFeature.Store();
                }
                m_mapControl.ActiveView.Refresh();
                frmW.Close();
                MessageBox.Show("绘制完成!");
            }
            ICommand pCommand = new ControlsMapFullExtentCommandClass();

            pCommand.OnCreate(m_mapControl.Object);
            pCommand.OnClick();
            m_statusBar.Panels[0].ProgressBarValue = 0;
        }
예제 #22
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("未启动编辑", "提示!"); }
            }
        }
예제 #23
0
 private void bubbleBtnFullExtent_Click(object sender, DevComponents.DotNetBar.ClickEventArgs e)
 {
     ICommand pCommand = new ControlsMapFullExtentCommandClass();
     pCommand.OnCreate(this.mainMapControl.Object);
     pCommand.OnClick();
 }
예제 #24
0
 public override void OnClick()
 {
     ICommand cmd = new ControlsMapFullExtentCommandClass();
     cmd.OnCreate(m_mapControl);
     cmd.OnClick();
 }
예제 #25
0
 //全图
 private void ctMenuMNFullExtent_Click(object sender, EventArgs e)
 {
     ICommand pCommand = new ControlsMapFullExtentCommandClass();
     pCommand.OnCreate(this.mainMapControl.Object);
     pCommand.OnClick();
 }
예제 #26
0
 /// <summary>
 /// 全局
 /// </summary>
 public static void FullExtent(AxMapControl axMapControl)
 {
     if (axMapControl == null)
     {
         return;
     }
     ICommand pCommand;
     pCommand = new ControlsMapFullExtentCommandClass();
     pCommand.OnCreate(axMapControl.Object);
     pCommand.OnClick();
 }
예제 #27
0
파일: frmMain.cs 프로젝트: lovelll/DQHP
        private void dotNetBarManager1_ItemClick(object sender, EventArgs e)
        {
            AxMapControl pAxMapControl = this.axMapControlMain;
            BaseItem item = sender as BaseItem;
            if (item == null) return;
            iFlagSelection = -1;
            switch (item.Name)
            {
                //新建工程
                case "mFileNewProject":
                case "bStandardNewProject":
                    ESRISysUI.ICommand pNewProject = new ESRICmdLib.ControlsNewDocCommandClass();
                    pNewProject.OnCreate(pAxMapControl.Object);
                    pNewProject.OnClick();
                    break;
                case "mFileOpenProject":
                case "bStandardOpenProject":
                    ESRISysUI.ICommand pOpenProject = new ControlsOpenDocCommandClass();
                    pOpenProject.OnCreate(pAxMapControl.Object);
                    pOpenProject.OnClick();
                    break;
                case "mFileSaveProject":
                case "bStandardSaveProject":
                    saveMapDocument(pAxMapControl);
                    break;
                case "mFileSaveAsProject":
                    ESRISysUI.ICommand pSaveAsProject = new ControlsSaveAsDocCommandClass();
                    pSaveAsProject.OnCreate(pAxMapControl.Object);
                    pSaveAsProject.OnClick();
                    break;
                case "mFileMapExport":
                case "bStandardMapExport":
                    ESRISysUI.ICommand pMapExport = new ESRICmdLib.ControlsExportMapCommandClass();
                    pMapExport.OnCreate(pAxMapControl.Object);
                    pMapExport.OnClick();
                    break;
                case "mFileMapPrint":
                case "bStandardPrint":
                    ESRISysUI.ICommand pMapPrint = new ESRICmdLib.ControlsPrintMapCommandClass();
                    pMapPrint.OnCreate(pAxMapControl.Object);
                    pMapPrint.OnClick();
                    break;
                case "mFileAddData":
                case "bStandardAddData":
                    ESRISysUI.ICommand pAddData = new ControlsAddDataCommandClass();
                    pAddData.OnCreate(pAxMapControl.Object);
                    pAddData.OnClick();
                    break;

                case "mFileExitSystem":
                    this.Close();
                    break;
                case "mViewLayerManagement":
                    this.barLayerManagement.Visible = (item as ButtonItem).Checked;
                    break;
                //mViewToolbox
                case "mViewToolboxStandard":
                    this.barToolboxStandard.Visible = (item as ButtonItem).Checked;
                    break;
                case "mViewToolboxMap":
                    this.barToolboxMap.Visible = (item as ButtonItem).Checked;
                    break;
                case "mViewStatusbar":
                    this.statusStripMain.Visible = (item as ButtonItem).Checked;
                    break;
                case "mEcoRedLineGeoHazards":
                    break;
                case "mEcoRedLineTerrain":
                    frmTerrain pFrmTerrain = new frmTerrain(pAxMapControl.Map);
                    pFrmTerrain.ShowDialog();
                    break;
                case "mEcoRedLineWSCons":
                    frmWaterSoilConservation pFrmWaterSoilConervation = new frmWaterSoilConservation(pAxMapControl.Map);
                    pFrmWaterSoilConervation.ShowDialog();
                    break;
                case "mEcoRedLineWCons":
                    frmWaterConervation pFrmWaterConervation = new frmWaterConervation(pAxMapControl.Map);
                    pFrmWaterConervation.ShowDialog();
                    break;
                case "mEcoRedLineFlood":
                    MessageBox.Show("正在研发!");
                    break;
                case "mEcoRedLineBiodiversity":
                    MessageBox.Show("正在研发!");
                    break;
                //预测
                case "mTrendPop":
                    frmPOP pFrmPop = new frmPOP();
                    pFrmPop.ShowDialog();
                    break;
                case "mTrendGdp":
                    frmGDP pFrmGdp = new frmGDP();
                    pFrmGdp.ShowDialog();
                    break;
                case "mTrendLand":
                    MessageBox.Show("正在研发!");
                    break;
                case "mOptDLS":
                    frmDLSSimulation pFrmDLSSimulation = new frmDLSSimulation(pAxMapControl.Map);
                    pFrmDLSSimulation.ShowDialog();
                    break;
                //空间分析
                case "mSpBuffer":
                    frmBuffer pFrmBuffer = new frmBuffer(pAxMapControl.Map);
                    pFrmBuffer.ShowDialog();
                    pFrmBuffer.Dispose();
                    break;
                case "mSpClip":
                    frmClips pFrmClip = new frmClips(pAxMapControl.Map);
                    pFrmClip.ShowDialog();
                    pFrmClip.Dispose();
                    break;
                case "mSpReClass":
                    frmRasterReClass pFrmRaterReClass = new frmRasterReClass(pAxMapControl.Map);
                    pFrmRaterReClass.ShowDialog();
                    pFrmRaterReClass.Dispose();
                    break;
                case "mSpSlope":
                    frmSlope pFrmSlope = new frmSlope(pAxMapControl.Map);
                    pFrmSlope.ShowDialog();
                    pFrmSlope.Dispose();
                    break;
                case "mSpAspect":
                    frmAspect pFrmAspect = new frmAspect(pAxMapControl.Map);
                    pFrmAspect.ShowDialog();
                    pFrmAspect.Dispose();
                    break;
                case "mSpDtFeature2Raster":
                    frmFeatureToRaster pFrmFeatureToRaster = new frmFeatureToRaster(pAxMapControl.Map);
                    pFrmFeatureToRaster.ShowDialog();
                    pFrmFeatureToRaster.Dispose();
                    break;
                case "mSpDtRaster2Feature":
                    frmRasterToFeature pFrmRasterToFeature = new frmRasterToFeature(pAxMapControl.Map);
                    pFrmRasterToFeature.ShowDialog();
                    pFrmRasterToFeature.Dispose();
                    break;
                case "mSpStatistic":
                    frmStatistic pFrmStatistic = new frmStatistic(pAxMapControl.Map);
                    pFrmStatistic.ShowDialog();
                    pFrmStatistic.Dispose();
                    break;
                case "mHelpHelp":
                    //PageLayout.frmPageLayout pageLayout = new PageLayout.frmPageLayout(this.mapControl.Object as IMapControl3);
                    //pageLayout.Owner = this;
                    //pageLayout.Show();
                    MessageBox.Show("正在研发!");
                    break;
                case "mHelpAbout":
                    frmReport p = new frmReport(pAxMapControl.Map);
                    p.ShowDialog();
                    p.Dispose();
                    //RasterSymbology.frmSymbology p = new RasterSymbology.frmSymbology(this._mapControl.ActiveView.FocusMap.get_Layer(0) as IRasterLayer, this._mapControl as IMapControl4,this._tocControl as ITOCControl2);
                    //p.ShowDialog();
                    //p.Dispose();

                    //MessageBox.Show("正在研发!");
                    break;

                //地图操作工具栏
                case "bMapZoomIn":
                    ESRISysUI.ICommand pZoomInTool = null;
                    pZoomInTool = new ControlsMapZoomInToolClass();
                    pZoomInTool.OnCreate(pAxMapControl.Object);
                    pAxMapControl.CurrentTool = pZoomInTool as ESRISysUI.ITool;
                    break;
                case "bMapZoomOut":
                    ESRISysUI.ICommand pZoomOutTool = null;
                    pZoomOutTool = new ControlsMapZoomOutToolClass();
                    pZoomOutTool.OnCreate(pAxMapControl.Object);
                    pAxMapControl.CurrentTool = pZoomOutTool as ESRISysUI.ITool;
                    break;
                case "bMapPan":
                    ESRISysUI.ICommand pPan = null;
                    pPan = new ControlsMapPanToolClass();
                    pPan.OnCreate(pAxMapControl.Object);
                    pAxMapControl.CurrentTool = pPan as ESRISysUI.ITool;
                    break;
                case "bMapFullExtent":
                    ESRISysUI.ICommand pFullExtent = null;
                    pFullExtent = new ControlsMapFullExtentCommandClass();
                    pFullExtent.OnCreate(pAxMapControl.Object);
                    pFullExtent.OnClick();
                    break;
                case "bMapFixedZoomIn":
                    ESRISysUI.ICommand pFixdZoomIn = null;
                    pFixdZoomIn = new ControlsMapZoomInFixedCommandClass();
                    pFixdZoomIn.OnCreate(pAxMapControl.Object);
                    pFixdZoomIn.OnClick();
                    break;
                case "bMapFixedZoomOut":
                    ESRISysUI.ICommand pFixedZoomOut = null;
                    pFixedZoomOut = new ControlsMapZoomOutFixedCommandClass();
                    pFixedZoomOut.OnCreate(pAxMapControl.Object);
                    pFixedZoomOut.OnClick();
                    break;
                case "bMapPreviousExtent":
                    ESRISysUI.ICommand pPreviousExtent = null;
                    pPreviousExtent = new ControlsMapZoomToLastExtentForwardCommandClass();
                    pPreviousExtent.OnCreate(pAxMapControl.Object);
                    pPreviousExtent.OnClick();
                    break;
                case "bMapNextExtent":
                    ESRISysUI.ICommand pNextExtent = null;
                    pNextExtent = new ControlsMapZoomToLastExtentBackCommandClass();
                    pNextExtent.OnCreate(pAxMapControl.Object);
                    pNextExtent.OnClick();
                    break;
                case "bMapSelection":
                    bMapSelection.ImageIndex = 14;
                    iFlagSelection = 0;
                    break;
                case "bMapSelectRectangle":
                    bMapSelection.ImageIndex = 14;
                    iFlagSelection = 1;
                    break;
                case "bMapSelectPolygon":
                    bMapSelection.ImageIndex = 15;
                    iFlagSelection = 2;
                    break;
                case "bMapSelectCircle":
                    bMapSelection.ImageIndex = 16;
                    iFlagSelection = 3;
                    break;
                case "bMapSelectLine":
                    bMapSelection.ImageIndex =17;
                    iFlagSelection = 4;
                    break;
                case "bMapSelectionClear":
                    ESRISysUI.ICommand pSelectionClear = null;
                    pSelectionClear = new ControlsClearSelectionCommandClass();
                    pSelectionClear.OnCreate(pAxMapControl.Object);
                    pSelectionClear.OnClick();
                    //IActiveView pActiveView=(IActiveView)(this.axMapControlMain.Map);
                    //pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                    //this.axMapControlMain.Map.ClearSelection();
                    //pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
                    //this.axMapControlMain.CurrentTool = null;
                    break;
                case "bMapIdentify":
                    //ESRISysUI.ICommand pIdentify = null;
                    //pIdentify = new ControlsMapIdentifyToolClass();
                    //pIdentify.OnCreate(pAxMapControl.Object);
                    //pAxMapControl.CurrentTool = pIdentify as ESRISysUI.ITool;
                    CMapTool cIden = new CMapTool();
                    cIden.Identify(this.axMapControlMain);

                    break;
                case "bMapMeasure":
                    //ESRISysUI.ICommand pMeasure = null;
                    //pMeasure = new ControlsMapMeasureToolClass();
                    //pMeasure.OnCreate(pAxMapControl.Object);
                    //pAxMapControl.CurrentTool = pMeasure as ESRISysUI.ITool;
                     CMapTool cMea = new CMapTool();
                    cMea.Measure(this.axMapControlMain);
                    break;

                default:
                    //MessageBox.Show("正在研发!");
                    break;
            }
        }
예제 #28
0
        /// <summary>
        /// �����ļ�չ���ͼ��
        /// </summary>
        public void TextToPoint()
        {
            if (m_FeatureLayer.FeatureClass.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint)
            {
                MessageBox.Show("��ȷ��չ��ĵ�һ��ͼ��Ϊ��ͼ��", "��ʾ��Ϣ", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                return;
            }
            OpenFileDialog openfileDialog = new OpenFileDialog();
            openfileDialog.Title = "��ѡ��չ���ͼ��������ļ�";
            openfileDialog.Filter = " txt files(*.txt)|*.txt|All files(*.*)|*.*";
            openfileDialog.RestoreDirectory = true;
            if (openfileDialog.ShowDialog() == DialogResult.OK)
            {
                frmW.WaitingLabel = "�����������...";
                frmW.Show();
                Application.DoEvents();
                LocalFilePath = openfileDialog.FileName;
                StreamReader strReadToEnd = new StreamReader(LocalFilePath);
                string sAllLine = strReadToEnd.ReadToEnd();
                int LineCount = sAllLine.Split('\n').Length + 1;
                string[] pline = new string[LineCount];
                double[] x = new double[LineCount];
                double[] y = new double[LineCount];
                string[] pSeparate = new string[] { };

                //m_statusBar.Panels[0].ProgressBarMinValue = 0;
                //m_statusBar.Panels[0].ProgressBarMaxValue = LineCount - 1;

                StreamReader strRead = new StreamReader(LocalFilePath);
                int i = 0;
                int j = 0;
                try
                {
                    if (strRead != null)
                    {
                        pline[i] = strRead.ReadLine();
                        while (pline[i] != null)
                        {
                            pSeparate = pline[i].Split(',', ' ', ';');
                            if (pSeparate.Length >= 3)
                            {
                                x[j] = double.Parse(pSeparate[1]);
                                y[j] = double.Parse(pSeparate[2]);
                                IFeatureClass pFeaCls = m_FeatureLayer.FeatureClass;
                                IFeature pFeature = pFeaCls.CreateFeature();
                                IPoint pPoint = new PointClass();
                                pPoint.X = x[j];
                                pPoint.Y = y[j];
                                pFeature.Shape = pPoint as IGeometry;
                                pFeature.Store();
                                m_mapControl.ActiveView.Refresh();
                                j++;
                                i++;
                                pline[i] = strRead.ReadLine();
                            }
                            else
                            {
                                i++;
                                pline[i] = strRead.ReadLine();
                            }
                            m_statusBar.Panels[0].ProgressBarValue = i;
                            frmW.WaitingLabel = "���ڻ��Ƶ� " + i.ToString() + " ����";
                            Application.DoEvents();
                        }
                    }
                    frmW.Close();
                    MessageBox.Show("������ɣ�");
                }
                catch
                {
                    MessageBox.Show("�����ı��ļ��ĵ�" + i + "��", "������Ϣ", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                }
            }
            ICommand pCommand = new ControlsMapFullExtentCommandClass();
            pCommand.OnCreate(m_mapControl.Object);
            pCommand.OnClick();
            m_statusBar.Panels[0].ProgressBarValue = 0;
        }