Example #1
0
        public void HandleCommandLine(string string_0)
        {
            ICommand command = this.method_9(string_0);

            if (command == null)
            {
                if (this.icommandLineWindows_0 != null)
                {
                    this.icommandLineWindows_0.ShowCommandString("无法识别的命令", 5);
                    this.RestoreCurrentTool();
                }
            }
            else
            {
                ITool tool = this.method_12();
                if ((tool == null) || ((tool as ICommand).Name != command.Name))
                {
                    if (this.icommandLineWindows_0 != null)
                    {
                        this.icommandLineWindows_0.LockCommandLine(false);
                    }
                    this.icommandLine_0 = command as ICommandLine;
                    if (command is ITool)
                    {
                        if (command.Enabled)
                        {
                            if (this.icommandLine_0 != null)
                            {
                                if (this.icommandLine_0.CommandType == COMMANDTYPE.STATECOMMAND)
                                {
                                    this.CancelCurrentTool();
                                    this.icommandLine_1 = null;
                                }
                            }
                            else
                            {
                                this._appContext.ShowCommandString("", CommandTipsType.CTTEnd);
                            }
                            this.method_10(command as ITool);
                        }
                        else
                        {
                            if (this.icommandLine_0 != null)
                            {
                                command.OnClick();
                            }
                            this.RestoreCurrentTool();
                        }
                    }
                    else
                    {
                        command.OnClick();
                        this.RestoreCurrentTool();
                    }
                    this.UpdateUI();
                }
            }
        }
        public override void OnClick()
        {
            if (_cmd == null || _AppHk == null)
            {
                return;
            }
            if (_AppHk.MapControl == null)
            {
                return;
            }
            int LayerCountOld = _AppHk.MapControl.Map.LayerCount;

            _cmd.OnClick();
            int LayerCountNew = _AppHk.MapControl.Map.LayerCount;

            //没必要进行任何排序,_cmd本身会自动根据新加载的图层类型进行排序
            //如何获取到新添加进来的图层呢?
            //for (int i = LayerCountOld; i < LayerCountNew; i++)
            //{
            //    GeoLayerTreeLib.LayerManager.ModuleMap.DealOrderOfNewLayer(_AppHk.MapControl as IMapControlDefault, _AppHk.MapControl.Map.get_Layer(i));
            //}
            //GeoLayerTreeLib.LayerManager.ModuleMap.LayersComposeEx(_AppHk.MapControl as IMapControlDefault);
            //LayersCompose(_AppHk.MapControl);
            if (this.WriteLog)
            {
                Plugin.LogTable.Writelog(base._Tooltip);//xisheng 2011.07.08 增加日志
            }
        }
Example #3
0
        /// <summary>
        /// 作用:单击按钮时触发的事件
        /// 作者:汪建龙
        /// 编写时间:2016年12月20日14:02:05
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                if (objCommand == null)
                {
                    CreateCommand();
                }

                if ((objCommand as ICommand) != null)
                {
                    ICommand cmd = objCommand as ICommand;
                    cmd.OnClick();

                    ITool tool = cmd as ITool;
                    if (tool != null &&
                        WorkBench.AxToolbarControl != null &&
                        WorkBench.AxToolbarControl.IsDisposed == false)
                    {
                        WorkBench.AxToolbarControl.CurrentTool = tool;
                    }
                }
                else if ((objCommand as ITLWCommand) != null)
                {
                    ITLWCommand cmd = objCommand as ITLWCommand;
                    cmd.OnClick();
                }
            }catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex);
                // LogManager.Log.LogError(ex.ToString());
            }
        }
Example #4
0
        /// <summary>
        /// 执行命令
        /// </summary>
        /// <param name="cmdprogid"></param>
        /// <returns></returns>
        public bool ExecuteCommand(string cmdprogid)
        {
            ICommandPool pCmdPool = axToolbarControl1.CommandPool;
            UID          pUid     = GetUIDFromStr(cmdprogid);
            ICommand     pCmd     = pCmdPool.FindByUID(pUid);

            if (pCmd != null)
            {
                if (pCmd is ITool)
                {
                    if (m_bMapView && m_mapControl != null)
                    {
                        m_mapControl.CurrentTool = pCmd as ITool;
                    }
                    else if (m_pageControl != null)
                    {
                        m_pageControl.CurrentTool = pCmd as ITool;
                    }
                }
                else
                {
                    pCmd.OnClick();
                }
                return(true);
            }
            return(false);
        }
Example #5
0
        private void barManager1_ItemClick(object sender, ItemClickEventArgs e)
        {
            ICommand tag = null;

            if (e.Item.Tag is ICommand)
            {
                tag = e.Item.Tag as ICommand;
            }
            else
            {
                tag = this.FindCommand(e.Item.Name);
            }
            if (tag != null)
            {
                if (tag is ITool)
                {
                    this.SetCurrentTool(tag as ITool);
                }
                else
                {
                    tag.OnClick();
                }
                this.UpdataUI();
            }
        }
Example #6
0
        public override void OnClick()
        {
            Plugin.Application.IAppGisUpdateRef phook = _AppHk as Plugin.Application.IAppGisUpdateRef;
            SysCommon.BottomQueryBar            pBar  = phook.QueryBar;
            if (pBar.m_WorkSpace == null)
            {
                pBar.m_WorkSpace = Plugin.ModuleCommon.TmpWorkSpace;
            }
            if (pBar.ListDataNodeKeys == null)
            {
                pBar.ListDataNodeKeys = Plugin.ModuleCommon.ListUserdataPriID;
            }
            PolygonBufferQueryToolClass pTool = _cmd as PolygonBufferQueryToolClass;

            pTool.WriteLog = WriteLog;//ygc 2012-9-12 是否写日志
            pTool.GetQueryBar(pBar);
            _cmd.OnClick();
            if (_AppHk.CurrentControl is IMapControl2)
            {
                _AppHk.MapControl.CurrentTool = _tool;
            }
            else
            {
                _AppHk.PageLayoutControl.CurrentTool = _tool;
            }

            _AppHk.CurrentTool = this.Name;
        }
Example #7
0
        private void barButtonItem33_ItemClick(object sender, ItemClickEventArgs e)
        {
            ICommand pCommand = m_pMapFixedZoomOutCommand;

            pCommand.OnCreate(axMapControl1.Object);
            pCommand.OnClick();
        }
Example #8
0
        public override void OnClick()
        {
            if (_tool == null || _cmd == null || _AppHk == null)
            {
                return;
            }
            if (_AppHk.CurrentControl == null)
            {
                return;
            }

            _cmd.OnCreate(_AppHk.CurrentControl);
            _cmd.OnClick();
            if (_AppHk.CurrentControl is ISceneControl)
            {
                _AppHk.SceneControl.CurrentTool = _tool;
            }
            else
            {
                return;
            }

            _AppHk.CurrentTool = this.Name;
            if (this.WriteLog)
            {
                Plugin.LogTable.Writelog("使用三维工具:" + Caption);//xisheng 日志记录07.08
            }
        }
Example #9
0
        public override void OnClick()
        {
            Plugin.Application.IAppGisUpdateRef phook = _AppHk as Plugin.Application.IAppGisUpdateRef;
            SysCommon.BottomQueryBar            pBar  = phook.QueryBar;
            if (pBar.m_WorkSpace == null)
            {
                pBar.m_WorkSpace = Plugin.ModuleCommon.TmpWorkSpace;
            }
            if (pBar.ListDataNodeKeys == null)
            {
                pBar.ListDataNodeKeys = Plugin.ModuleCommon.ListUserdataPriID;
            }
            ImportPolygonQueryToolClass pTool = _cmd as ImportPolygonQueryToolClass;

            pTool.GetQueryBar(pBar);
            _cmd.OnClick();
            //if (_AppHk.CurrentControl is IMapControl2)
            //{
            //    _AppHk.MapControl.CurrentTool = _tool;
            //}
            //else
            //{
            //    _AppHk.PageLayoutControl.CurrentTool = _tool;
            //}

            _AppHk.CurrentTool = this.Name;
        }
Example #10
0
        public override void OnClick()
        {
            if (m_Hook == null)
            {
                return;
            }

            if (m_Hook.ArcGisMapControl.Map.LayerCount == 0)
            {
                MessageBox.Show("当前没有调阅数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Plugin.LogTable.Writelog("标准分幅制图 提示‘当前没有调阅数据!’", m_Hook.tipRichBox);
                return;
            }
            ISpatialReference pSpatialRefrence = m_Hook.ArcGisMapControl.SpatialReference;

            if (!(pSpatialRefrence is IProjectedCoordinateSystem))
            {
                //MessageBox.Show("请设置地图的投影坐标!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //Plugin.LogTable.Writelog("标准分幅制图 提示‘请设置地图的投影坐标!’", m_Hook.tipRichBox);
                //return;
            }
            Plugin.LogTable.Writelog("宗地图", m_Hook.tipRichBox);
            _cmd = new CommandSelOutmapZD();
            _cmd.OnCreate(m_Hook.MapControl);
            _cmd.OnClick();
        }
        public override void OnClick()
        {
            Plugin.Application.IAppGisUpdateRef phook = _AppHk as Plugin.Application.IAppGisUpdateRef;
            SysCommon.BottomQueryBar            pBar  = phook.QueryBar;
            if (pBar.m_WorkSpace == null)
            {
                pBar.m_WorkSpace = Plugin.ModuleCommon.TmpWorkSpace;
            }
            if (pBar.ListDataNodeKeys == null)
            {
                pBar.ListDataNodeKeys = Plugin.ModuleCommon.ListUserdataPriID;
            }
            ControlsMapIdentify pTool = _cmd as ControlsMapIdentify;

            pTool.GetQueryBar(pBar);
            _cmd.OnClick();
            if (_tool == null || _cmd == null || _AppHk == null)
            {
                return;
            }
            if (_AppHk.MapControl == null)
            {
                return;
            }
            _AppHk.MapControl.CurrentTool = _tool;
            _AppHk.CurrentTool            = this.Name;
        }
Example #12
0
        public override void OnClick()
        {
            if (m_pCommand == null)
            {
                return;
            }
            (m_pCommand as GeoProperties.LayerPropertiesTool).CurLayer = _AppHk.MapControl.CustomProperty as ILayer;

            // shduan 20110721 增加RasterLayer和RasterCatalog图层属性*************************
            if (_AppHk.MapControl.CustomProperty is IFeatureLayer)
            {
                IFeatureLayer           pFeatLayer    = _AppHk.MapControl.CustomProperty as IFeatureLayer;
                IFeatureLayerDefinition pFLDefinition = pFeatLayer as IFeatureLayerDefinition;

                IFeatureClass pFeatClass = pFeatLayer.FeatureClass;
            }
            else if (_AppHk.MapControl.CustomProperty is  IRasterLayer)
            {
                IRasterLayer pRasterLayer = _AppHk.MapControl.CustomProperty as IRasterLayer;
            }
            else if (_AppHk.MapControl.CustomProperty is IRasterCatalog)
            {
                IRasterCatalog pRC = _AppHk.MapControl.CustomProperty as IRasterCatalog;
            }
            //end ******************************************************************************
            if (this.WriteLog)
            {
                Plugin.LogTable.Writelog("打开" + Message);//xisheng 2011.07.08 增加日志
            }
            m_pCommand.OnClick();
        }
Example #13
0
        public override void OnClick()
        {
            if (_tool == null || _cmd == null || _AppHk == null)
            {
                return;
            }
            if (_AppHk.MapControl == null)
            {
                return;
            }
            if (getEditLayer.isExistLayer(_AppHk.MapControl.Map) == null)
            {
                MessageBox.Show("请设置编辑图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            _cmd.OnClick();

            _tool = _cmd as ITool;
            if (_tool == null)
            {
                return;
            }

            if (_AppHk.CurrentControl is IMapControl2)
            {
                _AppHk.MapControl.CurrentTool = _tool;
            }
            else
            {
                _AppHk.PageLayoutControl.CurrentTool = _tool;
            }

            _AppHk.CurrentTool = this.Name;
            Plugin.LogTable.Writelog(Caption);
        }
Example #14
0
        private void barButtonItem37_ItemClick(object sender, ItemClickEventArgs e)
        {
            ICommand pCommand = m_pMapRefreshCommand;

            pCommand.OnCreate(axMapControl1.Object);
            pCommand.OnClick();
        }
Example #15
0
 public override void OnClick()
 {
     //实现FeatureClearSelect.OnClick事件
     GIS.Common.DataEditCommon.copypaste      = 0;
     GIS.Common.DataEditCommon.copypasteLayer = null;
     m_command.OnClick();
 }
Example #16
0
        /// <summary>
        /// 点击事件
        /// </summary>
        public override void OnClick()
        {
            if (DataEditCommon.g_pMyMapCtrl.CurrentTool != null)
            {
                DataEditCommon.g_pMyMapCtrl.CurrentTool = null;
            }

            m_command.OnClick();
        }
Example #17
0
        private void toolStripButton_RasterIdentify_Click(object sender, EventArgs e)
        {
            ITool    tool    = new RasterIdentifyTool();
            ICommand command = tool as ICommand;

            command.OnCreate(axMapControl2);
            axMapControl2.CurrentTool = tool;
            command.OnClick();
        }
Example #18
0
        private void toolZoomIn_Click(object sender, EventArgs e)
        {
            ITool    tool = new ControlsMapZoomInToolClass();
            ICommand cmd  = tool as ICommand;

            cmd.OnCreate(this.axMapControl1.Object);
            cmd.OnClick();
            this.axMapControl1.CurrentTool = tool;
        }
Example #19
0
        /// <summary>
        /// 卷帘
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripButton_SwiperLayer_Click(object sender, EventArgs e)
        {
            ITool    tool    = new SwipeLayerTool();
            ICommand command = tool as ICommand;

            command.OnCreate(axMapControl2);
            axMapControl2.CurrentTool = tool;
            command.OnClick();
        }
Example #20
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            bCreateOrNot = false;
            ICommand pCommand = this.axToolbarControl1.GetItem(0).Command as ICommand;

            pCommand.OnCreate(this.axMapControl1.Object);
            pCommand.OnClick();
            this.axMapControl1.CurrentTool = pCommand as ITool;
            this.tsbStartCreate.Enabled    = true;
        }
Example #21
0
 /// <summary>
 /// 点击事件
 /// </summary>
 public override void OnClick()
 {
     if (DataEditCommon.g_pMyMapCtrl.CurrentTool != null)
     {
         DataEditCommon.g_pMyMapCtrl.CurrentTool = null;
     }
     DataEditCommon.g_pMap.ClearSelection();
     DataEditCommon.g_pGraph.DeleteAllElements();
     m_command.OnClick();
 }
Example #22
0
        private void barCheckIdentify_ItemClick(object sender, ItemClickEventArgs e)
        {
            CommandIdentifyTool pIdentify = new CommandIdentifyTool();
            ICommand            cmd       = pIdentify;

            cmd.OnCreate(mainMapControl.Object);
            cmd.OnClick();
            ITool tool = (ITool)cmd;

            mainMapControl.CurrentTool = tool;
        }
 public override void OnClick()
 {
     if (_cmd == null || _AppHk == null)
     {
         return;
     }
     if (_AppHk.MapControl == null)
     {
         return;
     }
     _cmd.OnClick();
 }
Example #24
0
 private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
 {
     if (e.ClickedItem.Tag is ICommand)
     {
         ICommand tag = e.ClickedItem.Tag as ICommand;
         tag.OnClick();
         if (tag is ITool)
         {
             this.axMapControl1.CurrentTool = tag as ITool;
         }
         ApplicationRef.Application.UpdateUI();
     }
 }
Example #25
0
 private void barManager1_ItemClick(object sender, ItemClickEventArgs e)
 {
     if (e.Item.Tag is ICommand)
     {
         ICommand tag = e.Item.Tag as ICommand;
         tag.OnClick();
         if (tag is ITool)
         {
             this.axMapControl1.CurrentTool = tag as ITool;
         }
         ApplicationRef.Application.UpdateUI();
     }
 }
Example #26
0
        private void menuZoomOut_Click(object sender, EventArgs e)
        {
            //初始化对象
            ITool tool = new ControlsMapZoomOutToolClass();
            //查询接口,初始化Command类型
            ICommand cmd = tool as ICommand;

            //Command与MapControl关联
            cmd.OnCreate(this.axMapControl1.Object);
            cmd.OnClick();
            //当前MapControls的工具设为Pan
            this.axMapControl1.CurrentTool = tool;
        }
Example #27
0
        /// <summary>
        /// 8.2 放大
        /// </summary>
        private void menuZoomIn_Click(object sender, EventArgs e)
        {
            //Tool的定义和初始化
            ITool tool = new ControlsMapZoomInToolClass();
            //查询接口获取ICommand
            ICommand command = tool as ICommand;

            //Tool通过ICommand与MapControl的关联
            command.OnCreate(this.axMapControl1.Object);
            command.OnClick();
            //MapControl的当前工具设定为tool
            this.axMapControl1.CurrentTool = tool;
        }
        public override void OnClick()
        {
            if (_cmd == null || _AppHk == null)
            {
                return;
            }
            if (_AppHk.CurrentControl == null)
            {
                return;
            }

            _cmd.OnCreate(_AppHk.CurrentControl);
            _cmd.OnClick();
        }
Example #29
0
        /// <summary>
        /// The mouse up performs the action appropriate for each sub-typed command:
        /// insert vertex or delete vertex
        /// </summary>
        /// <param name="Button"></param>
        /// <param name="Shift"></param>
        /// <param name="X">The X screen coordinate of the clicked location</param>
        /// <param name="Y">The Y screen coordinate of the clicked location</param>
        public override void OnMouseUp(int Button, int Shift, int X, int Y)
        {
            try
            {
                //get layer being edited
                IFeatureLayer featureLayer = m_editLayer.TargetLayer as IFeatureLayer;

                //set the x,y location which will be used by the out-of-the-box commands
                IEngineEditSketch editsketch = m_engineEditor as IEngineEditSketch;
                editsketch.SetEditLocation(X, Y);

                Type   t = null;
                object o = null;

                switch (m_lSubType)
                {
                case 1:     //Insert Vertex using out-of-the-box command

                    t = Type.GetTypeFromProgID("esriControls.ControlsEditingVertexInsertCommand.1");
                    o = Activator.CreateInstance(t);
                    ICommand insertVertexCommand = o as ICommand;

                    if (insertVertexCommand != null)
                    {
                        insertVertexCommand.OnCreate(m_hookHelper.Hook);
                        insertVertexCommand.OnClick();
                    }

                    break;

                case 2:     //Delete Vertex using out-of-the-box command

                    t = Type.GetTypeFromProgID("esriControls.ControlsEditingVertexDeleteCommand.1");
                    o = Activator.CreateInstance(t);
                    ICommand deleteVertexCommand = o as ICommand;

                    if (deleteVertexCommand != null)
                    {
                        deleteVertexCommand.OnCreate(m_hookHelper.Hook);
                        deleteVertexCommand.OnClick();
                    }

                    break;
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.Message, "Unexpected Error");
            }
        }
Example #30
0
 public override void OnClick()
 {
     if (_cmd == null || _AppHk == null)
     {
         return;
     }
     if (_AppHk.PageLayoutControl == null)
     {
         return;
     }
     _cmd.OnClick();
     _AppHk.PageLayoutControl.CurrentTool = _tool;
     _AppHk.CurrentTool = this.Name;
 }
Example #31
0
        private void uiCommandBar2_CommandClick(object sender, Janus.Windows.UI.CommandBars.CommandEventArgs e)
        {
            if (e.Command.Key == "cmdPageSet")
            {
              /*  if (this.axPageLayoutControl1.PageLayout.Page.Orientation == 2)
                    pageSetupDialog1.PageSettings.Landscape = true ;
                else pageSetupDialog1.PageSettings.Landscape = false ; */
                #region//ҳ������
                //Show the page setup dialog storing the result.
                DialogResult result = pageSetupDialog1.ShowDialog();

                //set the printer settings of the preview document to the selected printer settings
                document.PrinterSettings = pageSetupDialog1.PrinterSettings;

                //set the page settings of the preview document to the selected page settings
                document.DefaultPageSettings = pageSetupDialog1.PageSettings;

                //due to a bug in PageSetupDialog the PaperSize has to be set explicitly by iterating through the
                //available PaperSizes in the PageSetupDialog finding the selected PaperSize
                int i;
                IEnumerator paperSizes = pageSetupDialog1.PrinterSettings.PaperSizes.GetEnumerator();
                paperSizes.Reset();

                for (i = 0; i < pageSetupDialog1.PrinterSettings.PaperSizes.Count; ++i)
                {
                    paperSizes.MoveNext();
                    if (((PaperSize)paperSizes.Current).Kind == document.DefaultPageSettings.PaperSize.Kind)
                    {
                        document.DefaultPageSettings.PaperSize = ((PaperSize)paperSizes.Current);
                    }
                }
                ///initialize the current printer from the printer settings selected
                ///in the page setup dialog

                IPaper paper;
                paper = new PaperClass(); //create a paper object

                IPrinter printer;
                printer = new EmfPrinterClass(); //create a printer object
                //in this case an EMF printer, alternatively a PS printer could be used

                //initialize the paper with the DEVMODE and DEVNAMES structures from the windows GDI
                //these structures specify information about the initialization and environment of a printer as well as
                //driver, device, and output port names for a printer
                paper.Attach(pageSetupDialog1.PrinterSettings.GetHdevmode(pageSetupDialog1.PageSettings).ToInt32(), pageSetupDialog1.PrinterSettings.GetHdevnames().ToInt32());

                //pass the paper to the emf printer
                printer.Paper = paper;

                //set the page layout control's printer to the currently selected printer
                axPageLayoutControl1.Printer = printer;
                #endregion

            }
            if (e.Command.Key == "cmdPrintView")
            {

                #region//��ӡԤ��
                //initialize the currently printed page number
                m_CurrentPrintPage = 0;

                //check if a document is loaded into PageLayout  control
                if (axPageLayoutControl1.ActiveView.FocusMap == null) return;
                //set the name of the print preview document to the name of the mxd doc
                document.DocumentName = axPageLayoutControl1.DocumentFilename;

                //set the PrintPreviewDialog.Document property to the PrintDocument object selected by the user
                printPreviewDialog1.Document = document;
               //   printPreviewDialog1 .pa
                printPreviewDialog1.Document.DefaultPageSettings = pageSetupDialog1.PageSettings;

                //show the dialog - this triggers the document's PrintPage event
                printPreviewDialog1.ShowDialog();
                #endregion
            }
            if (e.Command.Key == "cmdPrint")
            {
                #region //��ӡ
                //allow the user to choose the page range to be printed
                printDialog1.AllowSomePages = true;
                //show the help button.
                printDialog1.ShowHelp = true;

                //set the Document property to the PrintDocument for which the PrintPage Event
                //has been handled. To display the dialog, either this property or the
                //PrinterSettings property must be set
                printDialog1.Document = document;

                //show the print dialog and wait for user input
                DialogResult result = printDialog1.ShowDialog();

                // If the result is OK then print the document.
                if (result == DialogResult.OK) document.Print();
                #endregion
            }
            if (e.Command.Key == "cmdOpenFile")
            {

                m_Command = new ControlsOpenDocCommandClass();
                m_Command.OnCreate(axPageLayoutControl1.Object);
                m_Command.OnClick();

            }
            if (e.Command.Key == "cmdSaveFile")
            {
                m_Command = new ControlsSaveAsDocCommandClass();
                m_Command.OnCreate(axPageLayoutControl1.Object);
                m_Command.OnClick();
            }
            if (e.Command.Key == "cmdSelectElement")
            {
                m_Command = new ControlsSelectToolClass();
                this.axPageLayoutControl1.CurrentTool = (ITool)m_Command;
                m_Command.OnCreate(axPageLayoutControl1.Object);
                m_Command.OnClick();
            }
            if (e.Command.Key == "CmdExportMapAsPicture")
            {
                ICommand pExportMapAsPicture = new ExportMapProj.CmdExoprtMapAsPicture();
                pExportMapAsPicture.OnCreate(m_pageLayoutControl.Object);
                pExportMapAsPicture.OnClick();

            }
            if (e.Command.Key == "cmdChoseTemplete")
            {
                ChoseTemple chosetem = new ChoseTemple();
                chosetem.ShowDialog();
                if (chosetem.m_templateName != "")
                {
                    this.axPageLayoutControl1.ActiveView.Clear();
                    this.axPageLayoutControl1.LoadMxFile(System.Windows.Forms.Application.StartupPath + @"\pagelayoutTemplate\" + chosetem.m_templateName, Type.Missing);
                    SetMapFrame();
                    IMaps maps = new Maps();
                    maps.Add(m_Map);
                    m_pageLayoutControl.PageLayout.ReplaceMaps(maps);
                    axPageLayoutControl1.ActiveView.Refresh();

                }
            }
            if (e.Command.Key == "cmdScaleSetandPrint")//��������
            {
                frmSetMapScale frmSMS = new frmSetMapScale();
                 double pnewMapScale=frmSMS.setMapScale(m_mapScale,this .axPageLayoutControl1 .ActiveView .FocusMap.MapScale );
                 this.axPageLayoutControl1.ActiveView.FocusMap.MapScale = pnewMapScale;
                 this.axPageLayoutControl1.ActiveView.Refresh();
            }
        }
Example #32
0
        public void NavigationToolLibrary(string toolName)
        {
            switch (toolName)
            {
                case"ZoomIn":
                    m_command = new ControlsMapZoomInToolClass();
                    break;

                case "ZoomOut":
                    m_command = new ControlsMapZoomOutToolClass();
                    break;

                case "Pan":
                    m_command = new ControlsMapPanToolClass();
                    break;

                case "FullExtent":
                    m_command = new ControlsMapFullExtentCommandClass();
                    m_mapControl.ActiveView.FocusMap.ClipGeometry = null;
                    m_mapControl.ActiveView.Refresh();
                    break;

                case "Back":
                    m_command = new ControlsMapZoomToLastExtentBackCommandClass();
                    break;

                case "Forward":
                    m_command = new ControlsMapZoomToLastExtentForwardCommandClass();
                    break;

                case"SelectFeature":
                    m_command = new ControlsSelectFeaturesToolClass();
                    break;

                case"SelectElement":
                    m_command = new ControlsSelectToolClass();
                    break;

                case"Identify":
                    m_command = new ControlsMapIdentifyToolClass();
                    break;

                case"ClearSel":
                    m_command = new ControlsClearSelectionCommandClass();
                    break;

            }
            if (this.CurrentControl == "map" && m_command is ITool)
            {
                m_command.OnCreate(m_mapControl);
                m_mapControl.CurrentTool = (ITool)m_command;
            }
            else if (this.CurrentControl == "pagelayout" && m_command is ITool)
            {
                m_command.OnCreate(m_pageLayoutControl);
                m_pageLayoutControl.CurrentTool = (ITool)m_command;
            }
            else if (this.CurrentControl == "map")
            {
                m_command.OnCreate(m_mapControl);
                m_command.OnClick();
            }
            else
            {
                m_command.OnCreate(m_pageLayoutControl);
                m_command.OnClick();
            }
        }
Example #33
0
        public void StandardToolLibrary(string toolName)
        {
            switch (toolName)
            {
                case "AddData":
                    m_command = new ControlsAddDataCommandClass();
                    break;
                case"New":
                    m_command = new CreateNewDocument();
                    break;
                case"Open":
                    m_command = new ControlsOpenDocCommandClass();
                    break;
                case"Save":
                    break;
                case"SaveAs":
                    m_command = new ControlsSaveAsDocCommandClass();
                    break;
                case "CADToVec":
                    m_command = new AddCADToFeatures();
                    break;

                case "CADToRas":
                    m_command = new AddCADToRaster();
                    break;
            }
            if(m_command!=null)
            {
                m_command.OnCreate(m_mapControl.Object);
                m_command.OnClick();
                m_command = null;
            }

            if (toolName == "Open")
            {
                m_frmMian.ControlsSynchronizer.ReplaceMap(m_mapControl.Map);
            }

            if (toolName == "AddTin")
            {
                FolderBrowserDialog fdlg = new FolderBrowserDialog();
                fdlg.Description = "打开TIN";
                if (fdlg.ShowDialog() == DialogResult.OK)
                {
                    IWorkspaceFactory wsFac = new TinWorkspaceFactoryClass();
                    if (wsFac.IsWorkspace(System.IO.Path.GetDirectoryName(fdlg.SelectedPath)))
                    {
                        ITinWorkspace tinWS = wsFac.OpenFromFile(System.IO.Path.GetDirectoryName(fdlg.SelectedPath), 0) as ITinWorkspace;
                        ITinLayer tinLyr = new TinLayerClass();
                        try
                        {
                            tinLyr.Dataset = tinWS.OpenTin(System.IO.Path.GetFileName(fdlg.SelectedPath));
                            tinLyr.Name = System.IO.Path.GetFileName(fdlg.SelectedPath);
                            this.m_mapControl.Map.AddLayer((ILayer)tinLyr);
                        }
                        catch
                        {
                            MessageBox.Show("请选择有效的TIN文件!");
                        }
                    }
                    else
                    {
                        MessageBox.Show("请选择有效的TIN文件!");
                        return;
                    }

                }
            }

            if (toolName == "AddDEM")
            {
                FolderBrowserDialog fdlg = new FolderBrowserDialog();
                fdlg.Description = "打开DEM";
                if (fdlg.ShowDialog() == DialogResult.OK)
                {
                    IWorkspaceFactory wsFac = new RasterWorkspaceFactoryClass();
                    if (wsFac.IsWorkspace(System.IO.Path.GetDirectoryName(fdlg.SelectedPath)))
                    {
                        IRasterWorkspace tinWS = wsFac.OpenFromFile(System.IO.Path.GetDirectoryName(fdlg.SelectedPath), 0) as IRasterWorkspace;
                        IRasterLayer rasLyr = new RasterLayerClass();
                        try
                        {
                            rasLyr.CreateFromDataset(tinWS.OpenRasterDataset(System.IO.Path.GetFileName(fdlg.SelectedPath)));
                            this.m_mapControl.Map.AddLayer((ILayer)rasLyr);
                        }
                        catch
                        {
                            MessageBox.Show("请选择有效的DEM文件!");
                        }

                    }
                    else
                    {
                        MessageBox.Show("请选择有效的DEM文件!");
                        return;
                    }

                }
            }
        }
Example #34
0
        public void ThreeDToolLibrary(string toolName)
        {
            switch (toolName)
            {
                case"3DOpen":
                    m_command = new ControlsSceneOpenDocCommandClass();
                    break;

                case "Navigation":
                    m_command = new ControlsSceneNavigateToolClass();
                    break;

                case"3DZoomIn":
                    m_command = new ControlsSceneZoomInToolClass();
                    break;

                case "3DZoomOut":
                    m_command = new ControlsSceneZoomOutToolClass();
                    break;

                case "3DPan":
                    m_command = new ControlsScenePanToolClass();
                    break;

                case"3DExtent":
                    m_command = new ControlsSceneFullExtentCommandClass();
                    break;

                case"3DSel":
                    m_command = new ControlsSceneSelectGraphicsToolClass();
                    break;

            }
            if (m_command is ITool)
            {
                m_command.OnCreate(m_sceneControl.Object);
                m_sceneControl.CurrentTool = (ITool)m_command;
            }
            if (m_command is ICommand)
            {
                m_command.OnCreate(m_sceneControl.Object);
                m_command.OnClick();
            }
            m_command = null;

            if (toolName == "3DAddTIN")
            {
                FolderBrowserDialog fdlg = new FolderBrowserDialog();
                fdlg.Description = "打开TIN";
                if (fdlg.ShowDialog() == DialogResult.OK)
                {
                    IWorkspaceFactory wsFac = new TinWorkspaceFactoryClass();
                    if (wsFac.IsWorkspace(System.IO.Path.GetDirectoryName(fdlg.SelectedPath)))
                    {
                        ITinWorkspace tinWS = wsFac.OpenFromFile(System.IO.Path.GetDirectoryName(fdlg.SelectedPath), 0) as ITinWorkspace;
                        ITinLayer tinLyr = new TinLayerClass();
                        try
                        {
                            tinLyr.Dataset = tinWS.OpenTin(System.IO.Path.GetFileName(fdlg.SelectedPath));
                            this.m_sceneControl.Scene.AddLayer((ILayer)tinLyr,false);
                            SetTinAsBase(tinLyr);

                        }
                        catch
                        {
                            MessageBox.Show("请选择有效的TIN文件!");
                        }
                    }
                    else
                    {
                        MessageBox.Show("请选择有效的TIN文件!");
                        return;
                    }

                }
            }

            if (toolName == "3DAddDEM")
            {
                FolderBrowserDialog fdlg = new FolderBrowserDialog();
                fdlg.Description = "打开DEM";
                if (fdlg.ShowDialog() == DialogResult.OK)
                {
                    IWorkspaceFactory wsFac = new RasterWorkspaceFactoryClass();
                    if (wsFac.IsWorkspace(System.IO.Path.GetDirectoryName(fdlg.SelectedPath)))
                    {
                        IRasterWorkspace tinWS = wsFac.OpenFromFile(System.IO.Path.GetDirectoryName(fdlg.SelectedPath), 0) as IRasterWorkspace;
                        IRasterLayer rasLyr = new RasterLayerClass();
                        try
                        {
                            rasLyr.CreateFromDataset(tinWS.OpenRasterDataset(System.IO.Path.GetFileName(fdlg.SelectedPath)));
                            this.m_sceneControl.Scene.AddLayer((ILayer)rasLyr, false);
                            SetlayerSurface(rasLyr, 1);
                            //this.axSceneControl1.Refresh();
                        }
                        catch
                        {
                            MessageBox.Show("请选择有效的DEM文件!");
                        }

                    }
                    else
                    {
                        MessageBox.Show("请选择有效的DEM文件!");
                        return;
                    }

                }
            }
        }