• ArcGlobe组件开发之书签


    关于书签,主要实现创建书签,缩放至书签等功能。相关接口:ISceneBookmarks2 和IBookmark3D,实现过程很简单,代码如下:

      创建书签源码:

     public partial class CreateBookMark:DevComponents.DotNetBar.Office2007Form
        {
            public IGlobeControl m_globecontrol = null;
    
            public CreateBookMark (IGlobeControl globecontrol)   
            {
                this.m_globecontrol = globecontrol;
                InitializeComponent();
            }
            //创建书签
            private void buttonX_Create_Click (object sender,EventArgs e)
            {
                 if (textBox_BookMarkName.Text=="")
                 {
                     MessageBox.Show("请输入书签名!");
                 } 
                 else
                 {
                     ISceneBookmarks pBookmarks = m_globecontrol.Globe.GlobeDisplay.Scene as ISceneBookmarks;
                     IBookmark3D pBookmark3D = new Bookmark3DClass();
                     pBookmark3D.Name = textBox_BookMarkName.Text;
                     pBookmark3D.Capture(m_globecontrol.Globe.GlobeDisplay.ActiveViewer.Camera);
                     pBookmarks.AddBookmark(pBookmark3D);
    
                     this.Close();
                     this.Dispose();
                 }
    
            }
            private void buttonX_cancle_Click (object sender,EventArgs e)
            {
                this.Close();
                this.Dispose();
            }
    
        }

    书签管理器代码:

      public partial class BookmarkManager:DevComponents.DotNetBar.Office2007Form
        {
            //类成员
            private IGlobeControl m_globecontrol = null;
            private IArray m_BookmarkArray = null;
            private string m_bookmarkName = "";
           
            //构造函数
            public BookmarkManager (IGlobeControl globecontrol)
            {
                this.m_globecontrol = globecontrol;
                InitializeComponent();
            }
           
            //load
            private void BookmarkManager_Load (object sender,EventArgs e)
            {
                ISceneBookmarks2 sceneBookmarks = m_globecontrol.Globe as ISceneBookmarks2;
                m_BookmarkArray = sceneBookmarks.Bookmarks;
                for(int i = 0;i < sceneBookmarks.BookmarkCount;i++)
                {
                    IBookmark3D pBookmark = new Bookmark3DClass();
                    pBookmark = m_BookmarkArray.get_Element(i) as IBookmark3D;
                    listBox_Bookmarks.Items.Add(pBookmark.Name);
    
                }
    
            }
             //创建书签
            private void button_CreateBookmark_Click (object sender,EventArgs e)
            {
                CreateBookMark createBookMark = new CreateBookMark(m_globecontrol);
                createBookMark.ShowDialog();
            }
            //选中书签
            private void listBox_Bookmarks_SelectedIndexChanged (object sender,EventArgs e)
            {
                m_bookmarkName = listBox_Bookmarks.Items[listBox_Bookmarks.SelectedIndex].ToString();
            }
            //删除书签
            private void buttonX_remove_Click (object sender,EventArgs e)
            {
                ISceneBookmarks2 sceneBookmarks = m_globecontrol.Globe as ISceneBookmarks2;
                IBookmark3D bookmark3D = null;
                sceneBookmarks.FindBookmark(m_bookmarkName,out bookmark3D);
                if (bookmark3D!=null)
                {
                    sceneBookmarks.RemoveBookmark(bookmark3D);
                    listBox_Bookmarks.Items.Remove(this.listBox_Bookmarks.SelectedIndex);
                }
            }
            //缩放至
            private void button_Zoom2Bookmark_Click (object sender,EventArgs e)
            {
                ISceneBookmarks2 sceneBookmarks = m_globecontrol.Globe as ISceneBookmarks2;
                IBookmark3D bookmark3D = null;
                sceneBookmarks.FindBookmark(m_bookmarkName,out bookmark3D);
                if (bookmark3D!=null)
                {
                    bookmark3D.Apply(m_globecontrol.GlobeDisplay.ActiveViewer,true,0);
                    m_globecontrol.GlobeDisplay.RefreshViewers();
                }
                
            }
    
            private void buttonX_close_Click (object sender,EventArgs e)
            {
                this.Close();
                this.Dispose();
            }
        }


  • 相关阅读:
    关于2021-01-13爆发的incaseformat病毒相关信息收集1.2(持续更新和关注中...)
    (转)服务器UDIMM、LRDIMM、RDIMM三种内存的区别
    Shred命令 学习
    关于图片文件的元数据信息清理和时间戳修改
    关于Chrome 浏览器 “小尾巴”问题的解决办法
    CF471D MUH and Cube Walls -kmp
    UVA12467 Secret Word -kmp
    UVA12604 Caesar Cipher -kmp
    【JLOI2007】周期串
    Http协议
  • 原文地址:https://www.cnblogs.com/giser-whu/p/3707054.html
Copyright © 2020-2023  润新知