Пример #1
0
        //另存文档
        private void barBtnItemSaveAs_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ICommand command = new ControlsSaveAsDocCommandClass();

            command.OnCreate(m_mapControl.Object);
            command.OnClick();
        }
Пример #2
0
        private void menuItemSaveAs_Click(object sender, EventArgs e)
        {
            ICommand saveAsDocCommand = new ControlsSaveAsDocCommandClass();

            saveAsDocCommand.OnCreate(m_controlsSynchronizer.ActiveControl);
            saveAsDocCommand.OnClick();
        }
Пример #3
0
        /// <summary>
        /// 新建地图命令
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void New_Click(object sender, EventArgs e)
        {
            //询问是否保存当前地图
            DialogResult res = MessageBox.Show("是否保存当前地图?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (res == DialogResult.Yes)
            {
                //如果要保存,调用另存为对话框
                ICommand command = new ControlsSaveAsDocCommandClass();
                if (m_mapControl != null)
                {
                    command.OnCreate(m_controlsSynchronizer.MapControl.Object);
                }
                else
                {
                    command.OnCreate(m_controlsSynchronizer.PageLayoutControl.Object);
                }
                command.OnClick();
            }

            //创建新的地图实例
            IMap map = new MapClass();

            map.Name = "Map";
            m_controlsSynchronizer.MapControl.DocumentFilename = string.Empty;

            //更新新建地图实例的共享地图文档
            m_controlsSynchronizer.ReplaceMap(map);
        }
Пример #4
0
        private void 保存ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ICommand command = new ControlsSaveAsDocCommandClass();

            command.OnCreate(m_mapControl.Object);
            command.OnClick();
        }
Пример #5
0
        private void NewMapDoc()
        {
            DialogResult res = MessageBox.Show("是否保存当前文档?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (res == DialogResult.Yes)
            {
                ICommand command = new ControlsSaveAsDocCommandClass();
                if (m_MapControl != null)
                {
                    command.OnCreate(m_controlsSynchronizer.MapControl.Object);
                }
                else
                {
                    command.OnCreate(m_controlsSynchronizer.PageLayoutControl.Object);
                }
                command.OnClick();
            }

            IMap map = new MapClass();

            map.Name = "新建地图文档";
            m_controlsSynchronizer.MapControl.DocumentFilename = string.Empty;

            m_controlsSynchronizer.ReplaceMap(map);
        }
Пример #6
0
 private void menuSaveAs_Click(object sender, EventArgs e)
 {
     //execute SaveAs Document command
     ICommand command = new ControlsSaveAsDocCommandClass();
     command.OnCreate(m_mapControl.Object);
     command.OnClick();
 }
Пример #7
0
        private void SaveAsMapDoc()
        {
            ICommand command = new ControlsSaveAsDocCommandClass();

            command.OnCreate(m_controlsSynchronizer.ActiveControl);
            command.OnClick();
        }
        private void cmd_SaveAsDoc(System.Object sender, EventArgs e)
        {
            ICommand command = new ControlsSaveAsDocCommandClass();

            command.OnCreate(m_ControlsSynchronizer.ActiveControl);
            command.OnClick();
        }
Пример #9
0
        private void saveAnother_Click(object sender, EventArgs e)
        {
            ICommand cmd = new ControlsSaveAsDocCommandClass();

            cmd.OnCreate(axMapControl1.Object);
            cmd.OnClick();
        }
Пример #10
0
        private void menuNewDoc_Click(object sender, EventArgs e)
        {
            //execute New Document command
            DialogResult res = MessageBox.Show("Save the current map?", "Message",
                                               MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (res == DialogResult.Yes)
            {
                //Save As Command
                ICommand command = new ControlsSaveAsDocCommandClass();
                if (m_mapControl != null)
                {
                    command.OnCreate(m_controlsSynchronizer.MapControl.Object);
                }
                else
                {
                    command.OnCreate(m_controlsSynchronizer.PageLayoutControl.Object);
                }
                command.OnClick();
            }
            //create a new map instance
            IMap map = new MapClass();

            map.Name = "Unnamed Map";
            m_controlsSynchronizer.MapControl.DocumentFilename = string.Empty;

            m_controlsSynchronizer.ReplaceMap(map);
        }
Пример #11
0
        private void saveastoolStripMenuItem3_Click(object sender, EventArgs e)
        {
            ICommand saveas = new ControlsSaveAsDocCommandClass();

            saveas.OnCreate(axMapControl1.Object);
            saveas.OnClick();
        }
        /// <summary>
        /// New Map document menu event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void menuNewDoc_Click(object sender, System.EventArgs e)
        {
            //ask the user whether he'd like to save the current doc
            DialogResult res = MessageBox.Show("Would you like to save the current document?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (res == DialogResult.Yes)
            {
                //if yes, launch the SaveAs command
                ICommand command = new ControlsSaveAsDocCommandClass();
                command.OnCreate(m_controlsSynchronizer.PageLayoutControl.Object);
                command.OnClick();
            }

            // switch to map view
            tabControl1.SelectedTab = (TabPage)tabControl1.Controls[0];

            //create a new Map instance
            IMap map = new MapClass();

            map.Name = "Map";
            //replace the shared map with the new Map instance
            m_controlsSynchronizer.ReplaceMap(map);

            m_documentFileName = string.Empty;
        }
Пример #13
0
        private void Exit_Click(object sender, EventArgs e)
        {
            // 调用另存为命令
            ICommand command = new ControlsSaveAsDocCommandClass();

            command.OnCreate(m_controlsSynchronizer.ActiveControl);
            command.OnClick();
        }
Пример #14
0
        //保存地图
        public static void SaveAsDoc(AxGlobeControl _axGlobeControl)
        {
            ICommand pCommand;

            pCommand = new ControlsSaveAsDocCommandClass();
            pCommand.OnCreate(_axGlobeControl.Object);
            pCommand.OnClick();
        }
        /// <summary>
        /// SaveAs document menu event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>Save the current MapDocument as a new doc</remarks>
        private void menuSaveAsDoc_Click(object sender, System.EventArgs e)
        {
            //launch the SaveAs command. Always use the PageLayoutControl in order to keep
            // all of the map surrounds.
            ICommand command = new ControlsSaveAsDocCommandClass();

            command.OnCreate(m_controlsSynchronizer.PageLayoutControl.Object);
            command.OnClick();
        }
        //另存为
        private void SaveAsButton_Click(object sender, EventArgs e)
        {
            ICommand command = new ControlsSaveAsDocCommandClass();

            if (this.axMapControl1 != null)
            {
                command.OnCreate(this.axMapControl1.Object);
            }
            command.OnClick();
        }
Пример #17
0
                private void SavaAs_Click(object sender, EventArgs e)
               
        {
                        //execute SaveAs Document command
                        ICommand command = new ControlsSaveAsDocCommandClass();
                        command.OnCreate(m_mapControl.Object);

                        command.OnClick();

                   
        }
Пример #18
0
        public static void SaveMxdFile(AxMapControl axMapControl)
        {
            if (axMapControl == null)
            {
                return;
            }
            ICommand pCommand;

            pCommand = new ControlsSaveAsDocCommandClass();
            pCommand.OnCreate(axMapControl.Object);
            pCommand.OnClick();
        }
Пример #19
0
 private void menuSaveAs_Click(object sender, EventArgs e)
 {
     try
     {
         //execute SaveAs Document command
         ICommand command = new ControlsSaveAsDocCommandClass();
         command.OnCreate(m_mapControl.Object);
         command.OnClick();
     }
     catch (Exception ex)
     {
         frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
         return;
     }
 }
Пример #20
0
        private void SaveAs_Click(object sender, EventArgs e)
        {
            //如果当前视图为MapControl时,提示用户另存为操作将丢失PageLayoutControl中的设置
            if (m_controlsSynchronizer.ActiveControl is IMapControl3)
            {
                if (MessageBox.Show("另存为地图文档将丢失制版视图的设置\r\n您要继续吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
            }
            // 调用另存为命令
            ICommand command = new ControlsSaveAsDocCommandClass();

            command.OnCreate(m_controlsSynchronizer.ActiveControl);
            command.OnClick();
        }
Пример #21
0
        private void barButtonItem26_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                ICommand command = new ControlsSaveAsDocCommandClass();
                command.OnCreate(axMapControl1.Object);
                command.OnClick();
                MessageBox.Show("另存为地图文档成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }

            catch (Exception ex)

            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #22
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            //ask the user whether he'd like to save th ecurrent doc
            DialogResult res = MessageBox.Show("��ǰ�ĵ��Ƿ���Ҫ����?", "��Ϣ", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (res == DialogResult.Yes)
            {
            //if yes, launch the SaveAs command
            ICommand command = new ControlsSaveAsDocCommandClass();
            command.OnCreate(m_hookHelper.Hook);
            command.OnClick();
            }

            //create a new Map instance
            IMap map = new MapClass();
            map.Name = "��ͼ";
            m_mapControl.Map = map;
        }
Пример #23
0
        private void menuSaveAs_Click(object sender, EventArgs e)
        {
            if (m_controlsSynchronizer.ActiveControl is IMapControl3)
            {
                if (MessageBox.Show("Save as map document will lose the setting of layout\r\nContinue?",
                                    "Message", MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
            }
            //execute SaveAs Document command
            ICommand command = new ControlsSaveAsDocCommandClass();

            command.OnCreate(m_mapControl.Object);
            command.OnClick();
        }
 //地图文档另存
 public static void SaveAsMapDocument(ESRI.ArcGIS.Controls.AxMapControl axMapControl)
 {
     if (axMapControl == null)
     {
         return;
     }
     try
     {
         ICommand command;
         command = new ControlsSaveAsDocCommandClass();
         command.OnCreate(axMapControl.Object);
         command.OnClick();
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     } 
 }
Пример #25
0
 //地图文档另存
 public static void SaveAsMapDocument(ESRI.ArcGIS.Controls.AxMapControl axMapControl)
 {
     if (axMapControl == null)
     {
         return;
     }
     try
     {
         ICommand command;
         command = new ControlsSaveAsDocCommandClass();
         command.OnCreate(axMapControl.Object);
         command.OnClick();
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }
Пример #26
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            //check to see if there is an active edit session and whether edits have been made
            IEngineEditor engineEditor = new EngineEditorClass();

            if ((engineEditor.EditState == esriEngineEditState.esriEngineStateEditing) && engineEditor.HasEdits())
            {
                DialogResult result = MessageBox.Show(@"Is save the edit?", @"Save the edit",
                                                      MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                switch (result)
                {
                case DialogResult.Cancel:
                    return;

                case DialogResult.No:
                    engineEditor.StopEditing(false);
                    break;

                case DialogResult.Yes:
                    engineEditor.StopEditing(true);
                    break;
                }
            }
            //allow the user to save the current document
            DialogResult res = MessageBox.Show(@"Is save the current document?", @"Save document", MessageBoxButtons.YesNo,
                                               MessageBoxIcon.Question);

            if (res == DialogResult.Yes)
            {
                //launch the save command
                ICommand command = new ControlsSaveAsDocCommandClass();
                command.OnCreate(m_controlsSynchronizer.PageLayoutControl.Object);
                command.OnClick();
            }

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

            map.Name = "Map";

            //assign the new map to the MapControl
            //m_controlsSynchronizer.MapControl.DocumentFilename = string.Empty;
            m_controlsSynchronizer.ReplaceMap(map);
        }
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            //ask the user whether he'd like to save th ecurrent doc
            DialogResult res = MessageBox.Show("当前文档是否需要保存?", "消息", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (res == DialogResult.Yes)
            {
                //if yes, launch the SaveAs command
                ICommand command = new ControlsSaveAsDocCommandClass();
                command.OnCreate(m_hookHelper.Hook);
                command.OnClick();
            }

            //create a new Map instance
            IMap map = new MapClass();

            map.Name         = "地图";
            m_mapControl.Map = map;
        }
        //保存
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //询问是否保存当前地图
            DialogResult res = MessageBox.Show("是否保存当前地图?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (res == DialogResult.Yes)
            {
                //如果要保存,调用另存为对话框
                ICommand command = new ControlsSaveAsDocCommandClass();
                if (m_mapControl != null)
                {
                    command.OnCreate(m_controlsSynchronizer.MapControl.Object);
                }
                else
                {
                    command.OnCreate(m_controlsSynchronizer.PageLayoutControl.Object);
                }
                command.OnClick();
            }
        }
        //新建地图文档
        private void CreateNewMap_Click(object sender, EventArgs e)
        {
            //询问是否保存当前地图
            DialogResult res = MessageBox.Show("是否保存当前地图?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (res == DialogResult.Yes)
            {
                //如果要保存,调用另存为对话框
                ICommand command = new ControlsSaveAsDocCommandClass();
                if (this.axMapControl1 != null)
                {
                    command.OnCreate(this.axMapControl1.Object);
                }
                command.OnClick();
            }
            //创建新的地图实例
            IMap map = new MapClass();

            map.Name = "Map";
            this.axMapControl1.DocumentFilename = string.Empty;
        }
Пример #30
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            IMapControl3 mapControl = null;

            //get the MapControl from the hook in case the container is a ToolbatControl
            if (m_hookHelper.Hook is IToolbarControl)
            {
                mapControl = (IMapControl3)((IToolbarControl)m_hookHelper.Hook).Buddy;
            }
            //In case the container is MapControl
            else if (m_hookHelper.Hook is IMapControl3)
            {
                mapControl = (IMapControl3)m_hookHelper.Hook;
            }
            else
            {
                MessageBox.Show("Active control must be MapControl!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            //allow the user to save the current document
            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!?)
                ICommand command = new ControlsSaveAsDocCommandClass();
                command.OnCreate(m_hookHelper.Hook);
                command.OnClick();
            }

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

            map.Name = "Map";

            //assign the new map to the MapControl
            mapControl.DocumentFilename = string.Empty;
            mapControl.Map = map;
        }
Пример #31
0
        //点击事件响应函数
        public override void OnClick()
        {
            IMapControl3 mapControl = null;

            //如果容器是ToolbatControl,通过hook(钩)获取到MapControl
            if (m_hookHelper.Hook is IToolbarControl)
            {
                mapControl = (IMapControl3)((IToolbarControl)m_hookHelper.Hook).Buddy;
            }
            //如果容器是MapControl
            else if (m_hookHelper.Hook is IMapControl3)
            {
                mapControl = (IMapControl3)m_hookHelper.Hook;
            }
            else
            {
                MessageBox.Show("当前控件必须是MapControl!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            //提示用户是否保存当前地图文档
            DialogResult res = MessageBox.Show("是否保存当前地图文档?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (res == DialogResult.Yes)
            {
                //启动保存命令
                ICommand command = new ControlsSaveAsDocCommandClass();
                command.OnCreate(m_hookHelper.Hook);
                command.OnClick();
            }

            //创建新Map
            IMap map = new MapClass();

            map.Name = "Map";

            //加载新地图
            mapControl.DocumentFilename = string.Empty;
            mapControl.Map = map;
        }
Пример #32
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override 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!?)
                ICommand command = new ControlsSaveAsDocCommandClass();
                command.OnCreate(m_hookHelper.Hook);
                command.OnClick();
            }

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

            map.Name = "Map";

            //assign the new map to the MapControl
            mapControl.DocumentFilename = string.Empty;
            mapControl.Map = map;
        }
        //点击事件响应函数
        public override void OnClick()
        {
            IMapControl3 mapControl = null;

            //如果容器是ToolbatControl,通过hook(钩)获取到MapControl
            if (m_hookHelper.Hook is IToolbarControl)
            {
                mapControl = (IMapControl3)((IToolbarControl)m_hookHelper.Hook).Buddy;
            }
            //如果容器是MapControl
            else if (m_hookHelper.Hook is IMapControl3)
            {
                mapControl = (IMapControl3)m_hookHelper.Hook;
            }
            else
            {
                MessageBox.Show("当前控件必须是MapControl!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            //提示用户是否保存当前地图文档
            DialogResult res = MessageBox.Show("是否保存当前地图文档?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (res == DialogResult.Yes)
            {
                //启动保存命令
                ICommand command = new ControlsSaveAsDocCommandClass();
                command.OnCreate(m_hookHelper.Hook);
                command.OnClick();
            }

            //创建新Map
            IMap map = new MapClass();
            map.Name = "Map";

            //加载新地图
            mapControl.DocumentFilename = string.Empty;
            mapControl.Map = map;
        }
Пример #34
0
 private void menuSaveAs_Click(object sender, EventArgs e)
 {
     //execute SaveAs Document command
     ICommand command = new ControlsSaveAsDocCommandClass();
     command.OnCreate(m_mapControl.Object);
     command.OnClick();
 }
Пример #35
0
 private void SaveAs_Map_Click(object sender, EventArgs e)
 {
     if (this.axMapControl1.LayerCount == 0)
     {
         MessageBox.Show("没有地图");
         return;
     }
     else
     {
         ICommand command = new ControlsSaveAsDocCommandClass();
         command.OnCreate(axMapControl1.Object);
         command.OnClick();
     }
 }
    /// <summary>
    /// Occurs when this command is clicked
    /// </summary>
    public override void OnClick()
    {
      IMapControl3 mapControl = null;

      //get the MapControl from the hook in case the container is a ToolbatControl
      if (m_hookHelper.Hook is IToolbarControl)
      {
        mapControl = (IMapControl3)((IToolbarControl)m_hookHelper.Hook).Buddy;
      }
      //In case the container is MapControl
      else if (m_hookHelper.Hook is IMapControl3)
      {
        mapControl = (IMapControl3)m_hookHelper.Hook;
      }
      else
      {
        MessageBox.Show("Active control must be MapControl!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        return;
      }

      //allow the user to save the current document
      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!?)
        ICommand command = new ControlsSaveAsDocCommandClass();
        command.OnCreate(m_hookHelper.Hook);
        command.OnClick();
      }

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

      //assign the new map to the MapControl
      mapControl.DocumentFilename = string.Empty;
      mapControl.Map = map;
    }
Пример #37
0
 public static void SaveMxdFile(AxMapControl axMapControl)
 {
     if (axMapControl == null)
     {
         return;
     }
     ICommand pCommand;
     pCommand = new ControlsSaveAsDocCommandClass();
     pCommand.OnCreate(axMapControl.Object);
     pCommand.OnClick();
 }
Пример #38
0
        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;
            }
        }
Пример #39
0
        //保存
        public static void Save(AxMapControl axMapControl)
        {
            DialogResult res = MessageBox.Show("是否保存当前地图?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (res == DialogResult.Yes)
            {
                ICommand pCommand = new ControlsSaveAsDocCommandClass();
                if(axMapControl!=null)
                pCommand.OnCreate(axMapControl.Object);

                IMap map = new MapClass();
                map.Name = "Map";
                axMapControl.DocumentFilename = string.Empty;
                 pCommand.OnClick();

            }
            if (axMapControl == null)
            {
                return;
            }
        }
    /// <summary>
    /// New Map document menu event handler
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void menuNewDoc_Click(object sender, System.EventArgs e)
    {
      //ask the user whether he'd like to save the current doc
      DialogResult res = MessageBox.Show("Would you like to save the current document?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
      if (res == DialogResult.Yes)
      {
        //if yes, launch the SaveAs command
        ICommand command = new ControlsSaveAsDocCommandClass();
        command.OnCreate(m_controlsSynchronizer.PageLayoutControl.Object);
        command.OnClick();
      }

      // switch to map view
      tabControl1.SelectedTab = (TabPage)tabControl1.Controls[0];

      //create a new Map instance
      IMap map = new MapClass();
      map.Name = "Map";
      //replace the shared map with the new Map instance
      m_controlsSynchronizer.ReplaceMap(map);

      m_documentFileName = string.Empty;
    }
Пример #41
0
        // File menu items
        void fileToolStripMenuItems_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menuItem = sender as ToolStripMenuItem;
            if (menuItem == null)
                return;
            ICommand command = null;
            string itemName = menuItem.Name;
            switch (itemName)
            {
                case "newDocToolStripMenuItem":
                    command = new CreateNewDocCmd();
                    command.OnCreate(m_MapControl.Object);
                    command.OnClick();
                    break;
                case "openDocToolStripMenuItem":
                    command = new ControlsOpenDocCommandClass();
                    command.OnCreate(m_MapControl.Object);
                    command.OnClick();
                    break;
                case "saveasStripMenuItem":
                    command = new ControlsSaveAsDocCommandClass();
                    command.OnCreate(m_MapControl.Object);
                    command.OnClick();
                    break;
                case "saveDocToolStripMenuItem":
                    if (m_MapControl.CheckMxFile(m_DocmentFileName))
                    {
                        IMapDocument mapDoc = new MapDocumentClass();
                        mapDoc.Open(m_DocmentFileName, string.Empty);
                        if (!mapDoc.get_IsReadOnly(m_DocmentFileName))
                        {
                            mapDoc.ReplaceContents((IMxdContents)m_MapControl.Map);
                            mapDoc.Save(mapDoc.UsesRelativePaths, false);
                            mapDoc.Close();
                        }
                        else
                            MessageBox.Show("Cann't be save because of read-only document");
                    }
                    break;
                case "exitDocToolStripMenuItem":
                    DialogResult res = MessageBox.Show("Whether to save the current document?", "AOView", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                    if (res == DialogResult.Yes)
                    {
                        command = new ControlsSaveAsDocCommandClass();
                        command.OnCreate(axMapControl1.Object);
                        command.OnClick();
                    }
                    Application.Exit();
                    break;

                default:
                    break;
            }
        }
Пример #42
0
 void IGMap.SaveAsMxd()
 {
     ICommand command = new ControlsSaveAsDocCommandClass();
     command.OnCreate(this._hook);
     command.OnClick();
 }
 /// <summary>
 /// SaveAs document menu event handler
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 /// <remarks>Save the current MapDocument as a new doc</remarks>
 private void menuSaveAsDoc_Click(object sender, System.EventArgs e)
 {
   //launch the SaveAs command. Always use the PageLayoutControl in order to keep 
   // all of the map surrounds. 
   ICommand command = new ControlsSaveAsDocCommandClass();
   command.OnCreate(m_controlsSynchronizer.PageLayoutControl.Object);
   command.OnClick();
 }
Пример #44
0
 //保存地图
 public static void SaveAsDoc(AxGlobeControl _axGlobeControl)
 {
     ICommand pCommand;
     pCommand = new ControlsSaveAsDocCommandClass();
     pCommand.OnCreate(_axGlobeControl.Object);
     pCommand.OnClick();
 }
Пример #45
0
 //另存文档
 private void barBtnItemSaveAs_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     ICommand command = new ControlsSaveAsDocCommandClass();
     command.OnCreate(m_mapControl.Object);
     command.OnClick();
 }
Пример #46
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            IMapControl3 mapControl = null;

            //get the MapControl from the hook in case the container is a ToolbarControl
            if (getSetHookHelper.Hook is IToolbarControl)
            {
                mapControl = (IMapControl3)((IToolbarControl)getSetHookHelper.Hook).Buddy;
            }
            //In case the container is MapControl
            else if (getSetHookHelper.Hook is IMapControl3)
            {
                mapControl = (IMapControl3)getSetHookHelper.Hook;
            }
            else
            {
                MessageBox.Show("Active control must be MapControl!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            //check to see if there is an active edit session and whether edits have been made
            DialogResult result;
            IEngineEditor engineEditor = new EngineEditorClass();

            if ((engineEditor.EditState == esriEngineEditState.esriEngineStateEditing) && (engineEditor.HasEdits() == true))
            {
                result = MessageBox.Show("Would you like to save your edits", "Save Edits", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

                switch (result)
                {

                    case DialogResult.Cancel:
                        return;

                    case DialogResult.No:
                        engineEditor.StopEditing(false);
                        break;

                    case DialogResult.Yes:
                        engineEditor.StopEditing(true);
                        break;

                }
            }

            //allow the user to save the current document
            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
                ICommand command = new ControlsSaveAsDocCommandClass();
                command.OnCreate(getSetHookHelper.Hook);
                command.OnClick();
            }

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

            //assign the new map to the MapControl
            mapControl.DocumentFilename = string.Empty;
            mapControl.Map = map;
        }
Пример #47
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            if (m_hookHelper != null)
            {
                //TODO: Add Map/PageLayout related logic
                object hook = null;
                if (m_hookHelper.Hook is IToolbarControl2)
                    hook = ((IToolbarControl2)m_hookHelper.Hook).Buddy;
                else
                    hook = m_hookHelper.Hook;

                IMapControl3 mapControl = hook as IMapControl3;
                if (mapControl == null)
                    return;

                // Save the current document
                DialogResult res = MessageBox.Show("Would you want to save the current document?", "AoView", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                if(res==DialogResult.Yes)
                {
                    ICommand command = new ControlsSaveAsDocCommandClass();
                    command.OnCreate(m_hookHelper.Hook);
                    command.OnClick();
                }

                // Create a new map
                IMap map = new MapClass();
                map.Name = "map";
                mapControl.DocumentFilename = string.Empty;
                mapControl.Map = map;
            }
            else if (m_sceneHookHelper != null)
            {
                //TODO: Add Scene related logic
            }
            else if (m_globeHookHelper != null)
            {
                //TODO: Add Globe related logic
            }
        }