Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
        public override void OnClick()
        {
            //if ( _AppHk == null) return;
            //if (_AppHk.CurrentControl == null) return;

            //m_pCommand.OnCreate(_AppHk.CurrentControl);
            //m_pCommand.OnClick();

            //_AppHk.CurrentTool = this.Name;
            if (_tool == null || m_pCommand == null || _AppHk == null)
            {
                return;
            }
            if (_AppHk.CurrentControl == null)
            {
                return;
            }

            m_pCommand.OnCreate(_AppHk.CurrentControl);
            //m_pCommand.OnClick();

            if (_AppHk.CurrentControl is ISceneControl)
            {
                _AppHk.SceneControl.CurrentTool = _tool;
            }
            else
            {
                return;
            }
            _AppHk.CurrentTool = this.Name;
        }
Exemplo n.º 3
0
 public void OnCreate(NBGIS.PluginEngine.IApplication hook)
 {
     if (hook != null)
     {
         this.hk = hook;
         cmd     = new ControlsMapFullExtentCommandClass();
         cmd.OnCreate(this.hk.MapControl);
     }
 }
Exemplo n.º 4
0
 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);
     }
 }
Exemplo n.º 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();
            }
        }
Exemplo n.º 6
0
 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;
 }
Exemplo n.º 7
0
 public override void OnCreate(Plugin.Application.IApplicationRef hook)
 {
     if (hook == null)
     {
         return;
     }
     _AppHk = hook as Plugin.Application.IAppGisUpdateRef;
     if (_AppHk.MapControl == null)
     {
         return;
     }
     m_pCommand.OnCreate(_AppHk);
     m_pAppForm = _AppHk as Plugin.Application.IAppFormRef;
 }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
0
        public override void OnClick()
        {
            if (_AppHk == null)
            {
                return;
            }
            if (_AppHk.CurrentControl == null)
            {
                return;
            }
            GeoArcScene3DAnalyse.Command3DVolumeAreaSta pTmpcmd = m_pCommand as GeoArcScene3DAnalyse.Command3DVolumeAreaSta;
            pTmpcmd.WriteLog = this.WriteLog;
            m_pCommand.OnCreate(_AppHk.CurrentControl);
            m_pCommand.OnClick();

            _AppHk.CurrentTool = this.Name;
        }
Exemplo n.º 10
0
        public override void OnClick()
        {
            if (_AppHk == null)
            {
                return;
            }
            if (_AppHk.CurrentControl == null)
            {
                return;
            }

            (m_pCommand as GeoArcScene3DAnalyse.Command3DSection).WriteLog = this.WriteLog;
            m_pCommand.OnCreate(_AppHk.CurrentControl);
            m_pCommand.OnClick();

            _AppHk.CurrentTool = this.Name;
        }
Exemplo n.º 11
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;
        }
Exemplo n.º 12
0
 public void OnClick()
 {
     cmd = new ControlsSaveAsDocCommandClass();
     cmd.OnCreate(this.m_mapControl);
     cmd.OnClick();
 }
Exemplo n.º 13
0
 public void OnClick()
 {
     cmd = new ControlsSaveAsDocCommandClass();
     cmd.OnCreate(this.m_mapControl);
     cmd.OnClick();
 }
Exemplo n.º 14
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;
        }
Exemplo n.º 15
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();
            }
        }