Exemplo n.º 1
0
 public FrmSceneBookmark(SceneBookmark _sbm)
 {
     InitializeComponent();
     sbm = _sbm;
 }
Exemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                //初始化系统路径
                DataFoldPath    = AppStartPath;                      // +"\\Data\\"; //系统数据文件夹路径
                GlobeMapPath    = DataFoldPath + Globe3ddMapName;    //定义三维地图路径
                MxdGlobeEyePath = DataFoldPath + MapMxdGlobeEyeName; //定义鹰眼地图路径

                //加载地图
                if (System.IO.File.Exists(GlobeMapPath))                    //如果该路径存在
                {
                    this.axGlobeControl1.Load3dFile(GlobeMapPath);          //加载三维地图
                }
                if (System.IO.File.Exists(MxdGlobeEyePath))                 //如果该路径存在
                {
                    this.axMapControl_GlobeEye.LoadMxFile(MxdGlobeEyePath); //加载鹰眼地图
                }

                this.axMapControl_GlobeEye.ShowScrollbars = false;       //隐藏条。

                this.axGlobeControl1.GlobeDisplay.GestureEnabled = true; //手势启用?
                this.axGlobeControl1.Navigate = true;                    //浏览模式
                GISBrowseTools.Navigate(this.axGlobeControl1);           //地图的默认工具为浏览

                //指北针
                this.axGlobeControl1.GlobeViewer.NorthArrowEnabled = !this.axGlobeControl1.GlobeViewer.NorthArrowEnabled;

                btnFlyToSubItemDefaultCount    = btnFlyTo.SubItems.Count;                                          //飞行动画按钮默认字按钮个数
                btnBookmarkSubItemDefaultCount = btnBookmark.SubItems.Count;                                       //场景书签按钮默认子按钮个数
                btnLayerManagerSubDefaultCount = btnLayerManager.SubItems.Count;                                   //图层管理的子按钮个数

                #region                                                                                            //场景书签按钮
                if (pSceneBookmark == null)                                                                        //如果类为空
                {
                    pSceneBookmark = new SceneBookmark(this.axGlobeControl1, this.btnBookmark, btnBookmark_Click); //实例化书签类,并传入axGlobeControl
                }
                if (this.btnBookmark.SubItems.Count <= btnBookmarkSubItemDefaultCount)                             //如果子按钮少于三个,就说明没有加载场景书签
                {
                    pSceneBookmark.LoadBookmarksAsButton();                                                        //加载场景按钮
                }
                #endregion

                #region                                             //沿路径飞行
                FlyPathFoldPath = AppStartPath + "\\Data\\FlyPath"; //飞行文件的文件夹
                if (!Directory.Exists(FlyPathFoldPath))             //如果路径不存在
                {
                    MessageBox.Show("飞行路径文件丢失,请确保程序的完整性", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    //取得飞行路径list
                    if (FlyPathNameList == null)
                    {
                        FlyPathNameList = FlyAccordingPath.Fly.getFileListFromFoldPath(FlyPathFoldPath);
                    }
                    //添加飞行路径子按钮
                    if (this.btnFlyTo.SubItems.Count == btnFlyToSubItemDefaultCount)                //如果按钮个数为默认个数,则说明没有添加
                    {
                        UIControl.AddFlyPathButton(FlyPathNameList, this.btnFlyTo, btnFlyTo_Click); //以飞行路径名,加载按钮
                    }
                }
                #endregion

                #region //图层管理
                //取得图层list
                if (LayerNameList == null)
                {
                    LayerNameList = CommonBaseTool.BaseGISTools.getLayerNameList(this.axGlobeControl1);
                }
                //添加子按钮
                if (this.btnLayerManager.SubItems.Count == btnLayerManagerSubDefaultCount)
                {
                    UIControl.AddLayerNameButons(LayerNameList, this.btnLayerManager, btnLayerManager_Click);   //添加图层子按钮
                }
                #endregion
            }
            catch
            { }
        }
Exemplo n.º 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                //初始化系统路径
                DataFoldPath = AppStartPath;// +"\\Data\\"; //系统数据文件夹路径
                GlobeMapPath = DataFoldPath + Globe3ddMapName;  //定义三维地图路径
                MxdGlobeEyePath = DataFoldPath + MapMxdGlobeEyeName;    //定义鹰眼地图路径

                //加载地图
                if (System.IO.File.Exists(GlobeMapPath))  //如果该路径存在
                {
                    this.axGlobeControl1.Load3dFile(GlobeMapPath);  //加载三维地图
                }
                if (System.IO.File.Exists(MxdGlobeEyePath))  //如果该路径存在
                {
                    this.axMapControl_GlobeEye.LoadMxFile(MxdGlobeEyePath); //加载鹰眼地图
                }

                this.axMapControl_GlobeEye.ShowScrollbars = false;  //隐藏条。

                this.axGlobeControl1.GlobeDisplay.GestureEnabled = true;           //手势启用?
                this.axGlobeControl1.Navigate = true;       //浏览模式
                GISBrowseTools.Navigate(this.axGlobeControl1);      //地图的默认工具为浏览

                //指北针
                this.axGlobeControl1.GlobeViewer.NorthArrowEnabled = !this.axGlobeControl1.GlobeViewer.NorthArrowEnabled;

                btnFlyToSubItemDefaultCount = btnFlyTo.SubItems.Count; //飞行动画按钮默认字按钮个数
                btnBookmarkSubItemDefaultCount = btnBookmark.SubItems.Count;    //场景书签按钮默认子按钮个数
                btnLayerManagerSubDefaultCount = btnLayerManager.SubItems.Count;    //图层管理的子按钮个数

                #region //场景书签按钮
                if (pSceneBookmark == null)     //如果类为空
                {
                    pSceneBookmark = new SceneBookmark(this.axGlobeControl1, this.btnBookmark, btnBookmark_Click);   //实例化书签类,并传入axGlobeControl
                }
                if (this.btnBookmark.SubItems.Count <= btnBookmarkSubItemDefaultCount)    //如果子按钮少于三个,就说明没有加载场景书签
                {
                    pSceneBookmark.LoadBookmarksAsButton(); //加载场景按钮
                }
                #endregion

                #region //沿路径飞行
                FlyPathFoldPath = AppStartPath + "\\Data\\FlyPath";  //飞行文件的文件夹
                if (!Directory.Exists(FlyPathFoldPath))  //如果路径不存在
                {
                    MessageBox.Show("飞行路径文件丢失,请确保程序的完整性", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    //取得飞行路径list
                    if (FlyPathNameList == null)
                    {
                        FlyPathNameList = FlyAccordingPath.Fly.getFileListFromFoldPath(FlyPathFoldPath);
                    }
                    //添加飞行路径子按钮
                    if (this.btnFlyTo.SubItems.Count == btnFlyToSubItemDefaultCount)      //如果按钮个数为默认个数,则说明没有添加
                    {
                        UIControl.AddFlyPathButton(FlyPathNameList, this.btnFlyTo, btnFlyTo_Click); //以飞行路径名,加载按钮
                    }
                }
                #endregion

                #region //图层管理
                //取得图层list
                if (LayerNameList == null)
                {
                    LayerNameList = CommonBaseTool.BaseGISTools.getLayerNameList(this.axGlobeControl1);
                }
                //添加子按钮
                if (this.btnLayerManager.SubItems.Count == btnLayerManagerSubDefaultCount)
                {
                    UIControl.AddLayerNameButons(LayerNameList, this.btnLayerManager, btnLayerManager_Click);   //添加图层子按钮
                }
                #endregion
            }
            catch
            { }
        }