• 大小: 0.15M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2024-04-23
  • 语言: C#
  • 标签: 生成  AE  

资源简介

利用二次开发

资源截图

代码片段和文件信息

using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using ESRI.ArcGIS.ADF.baseClasses;
using ESRI.ArcGIS.ADF.CATIDs;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.SystemUI;

namespace CreateDEM
{
    /// 
    /// Summary description for CreateNewDocument.
    /// 

    public class CreateNewDocument : baseCommand
    {
        private IHookHelper m_hookHelper = null;

        //constructor
        public CreateNewDocument()
        {
            //update the base properties
            base.m_category = “.NET Samples“;
            base.m_caption = “NewDocument“;
            base.m_message = “Create a new map“;
            base.m_toolTip = “Create a new map“;
            base.m_name = “DotNetTemplate_NewDocumentCommand“;
        }

        #region Overridden Class Methods

        /// 
        /// Occurs when this command is created
        /// 

        /// Instance of the application
        public override void OnCreate(object hook)
        {
            if (m_hookHelper == null)
                m_hookHelper = new HookHelperClass();

            m_hookHelper.Hook = hook;
        }

        /// 
        /// Occurs when this command is clicked
        /// 

        public override void onclick()
        {
            IMapControl3 mapControl = null;

            //get the MapControl from the hook in case the container is a ToolbarControl
            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;
            }

            //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.StopEdi

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件         869  2021-01-02 14:39  CreateDEM.sln
     文件       66048  2021-01-06 10:19  CreateDEM.v11.suo
     目录           0  2021-01-06 08:27  CreateDEM\
     文件        2238  2021-01-02 14:39  CreateDEM\App.ico
     目录           0  2021-01-02 15:12  CreateDEM\bin\
     目录           0  2021-01-06 08:59  CreateDEM\bin\Debug\
     文件       45056  2021-01-06 08:59  CreateDEM\bin\Debug\CreateDEM.exe
     文件       69120  2021-01-06 08:59  CreateDEM\bin\Debug\CreateDEM.pdb
     文件       22984  2021-01-06 10:18  CreateDEM\bin\Debug\CreateDEM.vshost.exe
     目录           0  2021-01-02 15:12  CreateDEM\bin\Release\
     文件        9083  2021-01-06 08:59  CreateDEM\CreateDEM.csproj
     文件         452  2021-01-02 14:55  CreateDEM\CreateDEM.csproj.user
     文件        3871  2021-01-02 14:39  CreateDEM\CreateNewDocument.cs
     文件        6114  2021-01-03 18:33  CreateDEM\creatTIN.cs
     文件        6533  2021-01-03 18:30  CreateDEM\creatTIN.Designer.cs
     文件        5817  2021-01-03 18:30  CreateDEM\creatTIN.resx
     文件        2238  2021-01-02 14:39  CreateDEM\Earth.ico
     文件        5030  2021-01-03 18:20  CreateDEM\FrmShpToTIN.cs
     文件        6122  2021-01-02 15:50  CreateDEM\FrmShpToTIN.Designer.cs
     文件        5817  2021-01-02 15:50  CreateDEM\FrmShpToTIN.resx
     文件        7326  2021-01-06 08:27  CreateDEM\FrmTxtToShp.cs
     文件        6026  2021-01-02 15:03  CreateDEM\FrmTxtToShp.Designer.cs
     文件        5817  2021-01-02 15:03  CreateDEM\FrmTxtToShp.resx
     文件        4980  2021-01-04 15:56  CreateDEM\MainForm.cs
     文件       15342  2021-01-03 18:46  CreateDEM\MainForm.Designer.cs
     文件       17745  2021-01-03 18:46  CreateDEM\MainForm.resx
     目录           0  2021-01-02 14:39  CreateDEM\obj\
     目录           0  2021-01-02 14:39  CreateDEM\obj\x86\
     目录           0  2021-01-06 08:59  CreateDEM\obj\x86\Debug\
     文件         180  2021-01-06 08:59  CreateDEM\obj\x86\Debug\CreateDEM.creatTIN.resources
     文件         867  2021-01-06 10:18  CreateDEM\obj\x86\Debug\CreateDEM.csproj.FileListAbsolute.txt
............此处省略26个文件信息

评论

共有 条评论