コード例 #1
0
ファイル: Form1.cs プロジェクト: petrolgxy/iTravel_project
 private void buttonItem16_Click(object sender, EventArgs e)
 {
     ESRI.ArcGIS.SystemUI.ITool    tool    = new ESRI.ArcGIS.Controls.ControlsMapZoomInToolClass();
     ESRI.ArcGIS.SystemUI.ICommand command = tool as ESRI.ArcGIS.SystemUI.ICommand;
     command.OnCreate(this.axMapControl2.Object);
     this.axMapControl2.CurrentTool = tool;
 }
コード例 #2
0
ファイル: cFullExtent.cs プロジェクト: yangmaoer/NBGis
 public void OnCreate(NBGIS.PluginEngine.IApplication hook)
 {
     if (hook != null)
     {
         this.hk = hook;
         cmd     = new ControlsMapFullExtentCommandClass();
         cmd.OnCreate(this.hk.MapControl);
     }
 }
コード例 #3
0
ファイル: cZoomOut.cs プロジェクト: yangmaoer/NBGis
 public void OnCreate(NBGIS.PluginEngine.IApplication hook)
 {
     if (hook != null)
     {
         hk   = hook;
         tool = new ControlsMapZoomOutToolClass();
         cmd  = tool as ESRI.ArcGIS.SystemUI.ICommand;
         cmd.OnCreate(this.hk.MapControl);
     }
 }
コード例 #4
0
ファイル: Form1.cs プロジェクト: petrolgxy/iTravel_project
 private void buttonItem14_Click(object sender, EventArgs e)
 {
     ESRI.ArcGIS.SystemUI.ITool tool = new ESRI.ArcGIS.Controls.ControlsMapZoomOutToolClass();
     //查询接口获取ICommand
     ESRI.ArcGIS.SystemUI.ICommand cmd = tool as ESRI.ArcGIS.SystemUI.ICommand;
     //Tool通过ICommand与MapControl的关联
     cmd.OnCreate(this.axMapControl2.Object);
     cmd.OnClick();
     //MapControl的当前工具设定为tool
     this.axMapControl2.CurrentTool = tool;
 }
コード例 #5
0
        public void OnClick()
        {
            //// 首先确认当前地图文档是否有效  
            //if (null != m_pageLayoutControl.DocumentFilename && m_mapControl.CheckMxFile(m_pageLayoutControl.DocumentFilename))  
            //{  
            //// 创建一个新的地图文档实例  
            //IMapDocument mapDoc = new MapDocumentClass();  // 打开当前地图文档  
            //mapDoc.Open(m_pageLayoutControl.DocumentFilename, string.Empty);  // 用 PageLayout 中的文档替换当前文档中的 PageLayout 部分  
            //mapDoc.ReplaceContents((IMxdContents)m_pageLayoutControl.PageLayout);  // 保存地图文档  
            //mapDoc.Save(mapDoc.UsesRelativePaths, false);  
            //mapDoc.Close();  

            //m_mapDocument = this.hk.Document;
            //if (m_mapDocument.get_IsReadOnly(m_mapDocument.DocumentFilename))
            //{
            //    MessageBox.Show("This map document is read only!");
            //    return;
            //}
            //m_mapDocument.Save(m_mapDocument.UsesRelativePaths, true);
            //MessageBox.Show("Changes saved successfully!");

            //execute Save Document command
            //m_mapDocumentName = m_mapControl.DocumentFilename;
            if (m_mapControl.DocumentFilename != null && m_mapControl.CheckMxFile(m_mapDocumentName))
            {
                //m_mapControl.CheckMxFile(m_mapDocumentName);
                //create a new instance of a MapDocument
                IMapDocument mapDoc = new MapDocumentClass();
                mapDoc.Open(m_mapDocumentName, string.Empty);

                //Make sure that the MapDocument is not readonly
                if (mapDoc.get_IsReadOnly(m_mapDocumentName))
                {
                    MessageBox.Show("Map document is read only!");
                    mapDoc.Close();
                    return;
                }

                //Replace its contents with the current map
                mapDoc.ReplaceContents((IMxdContents)m_mapControl.Map);

                //save the MapDocument in order to persist it
                mapDoc.Save(mapDoc.UsesRelativePaths, false);

                //close the MapDocument
                mapDoc.Close();
            }
            else
            {
                cmd = new ControlsSaveAsDocCommandClass();
                cmd.OnCreate(this.m_mapControl);
                cmd.OnClick();
            }
        }
コード例 #6
0
        public GeoCommand3DVolumeAreaSta()
        {
            base._Name    = "GeoArcScene3DAnalyse.GeoCommand3DVolumeAreaSta";
            base._Caption = "局部填挖方";
            base._Tooltip = "局部填挖方";
            base._Checked = false;
            base._Visible = true;
            base._Enabled = false;
            base._Message = "局部填挖方";

            m_pCommand = new GeoArcScene3DAnalyse.Command3DVolumeAreaSta();
        }
コード例 #7
0
        public CommandEnvelopeStatistics()
        {
            base._Name    = "GeoStatistics.CommandEnvelopeStatistics";
            base._Caption = "矩形范围统计";
            base._Tooltip = "矩形范围统计";
            base._Checked = false;
            base._Visible = true;
            base._Enabled = false;
            base._Message = "矩形范围统计";

            m_pCommand = new GeoStatistics.Command.ToolEvnelopeExport();
        }
コード例 #8
0
        public GeoCommandCuttfillAnalyse()
        {
            base._Name    = "GeoArcScene3DAnalyse.GeoCommandCuttfillAnalyse";
            base._Caption = "填挖方分析";
            base._Tooltip = "填挖方分析";
            base._Checked = false;
            base._Visible = true;
            base._Enabled = false;
            base._Message = "填挖方分析";

            m_pCommand = new GeoArcScene3DAnalyse.CommandCuttfillAnalyse();
        }
コード例 #9
0
        public GeoCommand3DSection()
        {
            base._Name    = "GeoArcScene3DAnalyse.GeoCommand3DSection";
            base._Caption = "剖面分析";
            base._Tooltip = "剖面分析";
            base._Checked = false;
            base._Visible = true;
            base._Enabled = false;
            base._Message = "剖面分析";

            m_pCommand = new GeoArcScene3DAnalyse.Command3DSection();
        }
コード例 #10
0
        public CommandIslandAreaStatistics()
        {
            base._Name    = "GeoStatistics.CommandIslandAreaStatistics";
            base._Caption = "海岛礁面积统计";
            base._Tooltip = "海岛礁面积统计";
            base._Checked = false;
            base._Visible = true;
            base._Enabled = false;
            base._Message = "海岛礁面积统计";

            m_pCommand = new GeoStatistics.Command.ToolAreaStatistics();
        }
コード例 #11
0
 public ControlsDrawRangePolygon()
 {
     base._Name       = "GeoDataEdit.ControlsDrawRangePolygon";
     base._Caption    = "·¶Î§Ãè»æ";
     base._Tooltip    = "·¶Î§Ãè»æ";
     base._Checked    = false;
     base._Visible    = true;
     base._Enabled    = true;
     base._Deactivate = false;
     base._Message    = "·¶Î§Ãè»æ";
     //base._Cursor = (int)esriControlsMousePointer.esriPointerIdentify;
     //base._Image = "";
     //base._Category = "";
     m_pCommand = new GeoDataEdit.Tools.ToolDrawPolygons();
 }
コード例 #12
0
        public override void OnCreate(Plugin.Application.IApplicationRef hook)
        {
            if (hook == null)
            {
                return;
            }
            _AppHk = hook as Plugin.Application.IAppGisUpdateRef;
            if (_AppHk.CurrentControl == null)
            {
                return;
            }

            m_pTool    = new GeoDataCenterFunLib.ControlsMapMeasureToolDefClass() as ESRI.ArcGIS.SystemUI.ITool;
            m_pCommand = m_pTool as ESRI.ArcGIS.SystemUI.ICommand;
            m_pCommand.OnCreate(_AppHk);
        }
コード例 #13
0
        private void barBtnSelectElement_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            CommonLib.MapMouseFlag = 1;
            DevExpress.XtraBars.BarButtonItem barBtn  = e.Item as DevExpress.XtraBars.BarButtonItem;
            ESRI.ArcGIS.SystemUI.ICommand     command = null;
            switch (barBtn.Name)
            {
            case "barBtnWholePageExtent":      //全屏
                command = new ESRI.ArcGIS.Controls.ControlsPageZoomWholePageCommand();
                break;

            case "barBtnPagePan":             //平移
                command = new ESRI.ArcGIS.Controls.ControlsPagePanTool();
                break;

            case "barBtnZoomIn":          //放大
                command = new ESRI.ArcGIS.Controls.ControlsPageZoomInTool();
                break;

            case "barBtnZoomOut":         //缩小
                command = new ESRI.ArcGIS.Controls.ControlsPageZoomOutTool();
                break;

            case "barBtnPreView":         //上一视图
                command = new ESRI.ArcGIS.Controls.ControlsPageZoomPageToLastExtentBackCommand();
                break;

            case "barBtnNextView":        //下一视图
                command = new ESRI.ArcGIS.Controls.ControlsPageZoomPageToLastExtentForwardCommand();
                break;

            default:
                break;
            }
            if (command != null)
            {
                command.OnCreate(axPageLayoutControl1.Object);
                if (command is ITool)
                {
                    axPageLayoutControl1.CurrentTool = command as ESRI.ArcGIS.SystemUI.ITool;
                }
                else
                {
                    command.OnClick();
                }
            }
        }
コード例 #14
0
        private void ExecuteWinCommand(ToolStripItem vToolStripItem)
        {
            if (vToolStripItem == null)
            {
                return;
            }
            string strToolStripName = vToolStripItem.Name.ToLower();

            ESRI.ArcGIS.SystemUI.ICommand pCommand = null;
            switch (strToolStripName)
            {
            case "bttopenalllayer":
                pCommand = new Command.ControlsOpenAllLayerCommand();
                break;

            case "bttcolsealllayer":
                pCommand = new Command.controlsColseAllLayerCommand();
                break;

            case "bttexpandalllayer":
                pCommand = new Command.ControlsExpandAllLayerCommand();
                break;

            case "bttcollapsealllayer":
                pCommand = new Command.ControlsCollapseAllLayerCommand();
                break;

            case "bttdeletealllayer":
                pCommand = new Command.ControlsDeleteAllLayerCommand();
                break;
            }

            if (pCommand == null)
            {
                return;
            }
            pCommand.OnCreate(this.axMapControl1.Object);
            if (pCommand is ITool)
            {
                this.axMapControl1.CurrentTool = pCommand as ITool;
            }
            else
            {
                pCommand.OnClick();
            }
            this.axTOCControl1.Update();
        }
コード例 #15
0
        public override void OnCreate(Plugin.Application.IApplicationRef hook)
        {
            if (hook == null)
            {
                return;
            }
            _AppHk = hook as Plugin.Application.IAppArcGISRef;

            if (_AppHk.MapControl == null)
            {
                return;
            }
            _tool      = new Tool3DLineOfSight();
            m_pCommand = _tool as ICommand;

            //m_pCommand.OnCreate(_AppHk.CurrentControl);
        }
コード例 #16
0
 private void PagelayoutViewer_Load(object sender, EventArgs e)
 {
     //地图导航默认平移
     ESRI.ArcGIS.SystemUI.ICommand command = null;
     command = new ESRI.ArcGIS.Controls.ControlsPagePanTool();
     if (command != null)
     {
         command.OnCreate(axPageLayoutControl1.Object);
         if (command is ITool)
         {
             axPageLayoutControl1.CurrentTool = command as ESRI.ArcGIS.SystemUI.ITool;
         }
         else
         {
             command.OnClick();
         }
     }
 }
コード例 #17
0
        public void OnClick()
        {
            // TODO: Add CreateNewDocument.OnClick implementation
            DialogResult res = MessageBox.Show("Would you like to save the current document?", "AoView", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (res == DialogResult.Yes)
            {
                //launch the save command (why work hard!?)
                cmd = new ControlsSaveAsDocCommandClass();
                cmd.OnCreate(this.hk.MapControl);
                cmd.OnClick();
            }

            //craete a new Map
            IMap map = new MapClass();

            map.Name = "Map";

            //assign the new map to the MapControl
            m_mapControl.DocumentFilename = string.Empty;
            m_mapControl.Map = map;
        }
コード例 #18
0
        public void OnClick()
        {
            // TODO: Add CreateNewDocument.OnClick implementation
            DialogResult res = MessageBox.Show("Would you like to save the current document?", "AoView", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (res == DialogResult.Yes)
            {
                //launch the save command (why work hard!?)
                cmd = new ControlsSaveAsDocCommandClass();
                cmd.OnCreate(this.hk.MapControl);
                cmd.OnClick();
            }

            //craete a new Map
            IMap map = new MapClass();
            map.Name = "Map";

            //assign the new map to the MapControl
            m_mapControl.DocumentFilename = string.Empty;
            m_mapControl.Map = map;
        }
コード例 #19
0
 public void OnClick()
 {
     cmd = new ControlsSaveAsDocCommandClass();
     cmd.OnCreate(this.m_mapControl);
     cmd.OnClick();
 }
コード例 #20
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("未启动编辑", "提示!"); }
            }
        }
コード例 #21
0
 public void OnClick()
 {
     cmd = new ControlsSaveAsDocCommandClass();
     cmd.OnCreate(this.m_mapControl);
     cmd.OnClick();
 }
コード例 #22
0
        public void OnClick()
        {
            //// 首先确认当前地图文档是否有效
            //if (null != m_pageLayoutControl.DocumentFilename && m_mapControl.CheckMxFile(m_pageLayoutControl.DocumentFilename))
            //{
            //// 创建一个新的地图文档实例
            //IMapDocument mapDoc = new MapDocumentClass();  // 打开当前地图文档
            //mapDoc.Open(m_pageLayoutControl.DocumentFilename, string.Empty);  // 用 PageLayout 中的文档替换当前文档中的 PageLayout 部分
            //mapDoc.ReplaceContents((IMxdContents)m_pageLayoutControl.PageLayout);  // 保存地图文档
            //mapDoc.Save(mapDoc.UsesRelativePaths, false);
            //mapDoc.Close();

            //m_mapDocument = this.hk.Document;
            //if (m_mapDocument.get_IsReadOnly(m_mapDocument.DocumentFilename))
            //{
            //    MessageBox.Show("This map document is read only!");
            //    return;
            //}
            //m_mapDocument.Save(m_mapDocument.UsesRelativePaths, true);
            //MessageBox.Show("Changes saved successfully!");

            //execute Save Document command
            //m_mapDocumentName = m_mapControl.DocumentFilename;
            if (m_mapControl.DocumentFilename != null && m_mapControl.CheckMxFile(m_mapDocumentName))
            {
                //m_mapControl.CheckMxFile(m_mapDocumentName);
                //create a new instance of a MapDocument
                IMapDocument mapDoc = new MapDocumentClass();
                mapDoc.Open(m_mapDocumentName, string.Empty);

                //Make sure that the MapDocument is not readonly
                if (mapDoc.get_IsReadOnly(m_mapDocumentName))
                {
                    MessageBox.Show("Map document is read only!");
                    mapDoc.Close();
                    return;
                }

                //Replace its contents with the current map
                mapDoc.ReplaceContents((IMxdContents)m_mapControl.Map);

                //save the MapDocument in order to persist it
                mapDoc.Save(mapDoc.UsesRelativePaths, false);

                //close the MapDocument
                mapDoc.Close();
            }
            else {
                cmd = new ControlsSaveAsDocCommandClass();
                cmd.OnCreate(this.m_mapControl);
                cmd.OnClick();
            }
        }