예제 #1
0
        private void FileButton_Click(object sender, EventArgs e)
        {
            try
            {
                ButtonItem btn = (ButtonItem)sender;
                switch (btn.Name)
                {
                //打开三维地图
                case "btnOpen3DMap":
                    UIControl.Open3DGlobeMap(this.axGlobeControl1, DataFoldPath);
                    break;

                //保存三维场景影像
                case "btnPrintMap":
                    // Windows用户桌面路径
                    string DesktopFoldPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
                    UIControl.SaveSceneAsImage(this.axGlobeControl1, DesktopFoldPath);
                    break;

                case "btnHelpDoc":
                    UIControl.OpenHelpDoc(DataFoldPath);
                    break;

                case "btnAboutUs":
                    UIControl.OpenAboutUsFrm();
                    break;

                case "btnSetRibbonVisible":
                    this.ribbonControl1.Expanded = !this.ribbonControl1.Expanded;
                    if (this.ribbonControl1.Expanded)
                    {
                        this.btnSetRibbonVisible.Image = this.imageList_RibbonVisible.Images[0];
                    }
                    else
                    {
                        this.btnSetRibbonVisible.Image = this.imageList_RibbonVisible.Images[1];
                    }
                    break;
                }
            }
            catch { }
        }
예제 #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
            { }
        }
예제 #3
0
        //飞行路径 点击事件
        private void btnFlyTo_Click(object sender, EventArgs e)
        {
            try
            {
                //判断是否为按钮
                if (!(sender is ButtonItem))
                {
                    return; //如果不是按钮,则返回
                }
                ButtonItem bi = (ButtonItem)sender;
                switch (bi.Name)
                {
                case "btnFlyPathManager":
                    //打开相应文件夹
                    System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("Explorer.exe");
                    psi.Arguments = "/e," + FlyPathFoldPath;
                    System.Diagnostics.Process.Start(psi);
                    break;

                case "btnFlyAlong6Cities":
                    FlyAlong6Cities();      //沿海经济带六个城市飞行
                    break;

                default:
                    if (bi.Name == "btnFlyTo")
                    {
                        return;
                    }
                    //将飞行动画控制面板显示
                    this.ribbonTab_FlyAnimation.Visible       = true;
                    this.ribbonControl1.SelectedRibbonTabItem = this.ribbonTab_FlyAnimation;
                    this.ribbonControl1.Refresh();

                    //以bookmark的方式缩放到飞行区域
                    string bookmarkName = UIControl.getBookmarkFromCityName(bi.Text);
                    pSceneBookmark.ZoomToScene(bookmarkName);

                    //System.Threading.Thread.Sleep(3000);    //暂停3秒

                    //如果飞行动画的类为空
                    if (flyAnimationClass == null)
                    {
                        flyAnimationClass = new FlyAccordingPath.Fly();
                    }
                    FlyClickedPathName = bi.Text;       //刚才被点击的按钮名称

                    //寻找此按钮是否有对应的Polyline
                    if (flyAnimationClass.InitAnimationPlay(this.axGlobeControl1, FlyClickedPathName, FlyPathFoldPath,
                                                            this.ratingItem_FlySpeed.Rating, this.checkBoxItem_Loop.Checked, this.checkBoxItem_LookDown.Checked))
                    {
                        IsFlyByPolyline = true;  //是按照Polyline的方式飞行
                        StartFlyPathThread();    // 启动多线程飞行方法

                        //进度条
                        ProgressBarValue = 0;
                        this.progressBarItem_FlyAnimation.Value = 0;
                        this.progressBarItem_FlyAnimation.Text  = "";
                        this.progressBarItem_FlyAnimation.Refresh();
                    }
                    else
                    {
                        IsFlyByPolyline = false;         //不是按照Polyline的方式飞行
                        flyAnimationClass.InitAnimationByAgaFile(this.axGlobeControl1, bi.Text, FlyPathFoldPath, false, this.ratingItem_FlySpeed.Rating);
                    }
                    break;
                }
            }
            catch { }
        }