Esempio n. 1
0
		private void StackPanel_Click(object sender, RoutedEventArgs e)
		{
			if (e.Source is Button)
			{
                this.spatialQueryUtil.removeListener();
				string name = (e.Source as Button).Name.ToString();
				switch (name)
				{
					case "DistanceMeasure"://距离测量
						{
							measureUtil.BeginMeasureDistance();
							break;
						}
					case "AreaMeasure"://面积测量
						{
							measureUtil.BeginMeasureArea();
							break;
						}
					case "HeightMeasure"://高度测量
						{
							measureUtil.BeginMeasureAltitude();
							break;
						}
					case "Clear"://清除
						{
							this.spatialQueryUtil.StopSpatialQuery();

							//清除量算结果
							this.measureUtil.ClearResult();
							//清除查询结果
							this.ClearQueryResult();
							break;
						}
					case "StartRoute"://开始飞行路径
						{
							if (SmObjectLocator.getInstance().FlyManagerObject.Routes.CurrentRoute != null)
							{
								SmObjectLocator.getInstance().FlyManagerObject.Play();
							}
							break;
						}
					case "PauseRoute"://暂停飞行路径
						{
							if (SmObjectLocator.getInstance().FlyManagerObject.Routes.CurrentRoute != null)
							{
								SmObjectLocator.getInstance().FlyManagerObject.Pause();
							}
							break;
						}
					case "StopRoute"://停止飞行路径
						{
							if (SmObjectLocator.getInstance().FlyManagerObject.Routes.CurrentRoute != null)
							{
								SmObjectLocator.getInstance().FlyManagerObject.Stop();
							}
							break;
						}
					case "ZoomIn"://放大
						{
							Camera currentCamera = SmObjectLocator.getInstance().GlobeObject.Scene.Camera;
							currentCamera.Altitude *= 0.5;
							SmObjectLocator.getInstance().GlobeObject.Scene.Fly(currentCamera, 1000);
							break;
						}
					case "ZoomOut"://缩小
						{
							Camera currentCamera = SmObjectLocator.getInstance().GlobeObject.Scene.Camera;
							currentCamera.Altitude /= 0.5;
							SmObjectLocator.getInstance().GlobeObject.Scene.Fly(currentCamera, 1000);
							break;
						}
					case "Stop"://停止
						{
							SmObjectLocator.getInstance().GlobeObject.Scene.StopFly();
							break;
						}
					case "FullExent"://全幅
						{
							SmObjectLocator.getInstance().GlobeObject.Scene.ViewEntire();
							break;
						}
					case "FlyRoute"://漫游飞行
						{
							if (this.PanelRegion.Visibility == Visibility.Collapsed)
							{
								this.PanelRegion.Visibility = Visibility.Visible;
							}
							else
							{
								this.PanelRegion.Visibility = Visibility.Collapsed;

								//重置飞行路径相关信息
								this.RouteListBox.SelectedIndex = -1;
								SmObjectLocator.getInstance().FlyManagerObject.Routes.Clear();
							}
							break;
						}
					case "FullScreen"://全屏
						{
							WindowsHelper winHelper = new WindowsHelper();
							if (this.WindowState == System.Windows.WindowState.Normal)
							{
								winHelper.adjustWindow(Application.Current.MainWindow, this, true);
							}
							else
							{
								winHelper.adjustWindow(Application.Current.MainWindow, this, false);
							}
							break;
						}
					case "ExitSystem"://退出系统
						{
							ConfirmWindow confirmWin = new ConfirmWindow();
							confirmWin.Owner = Application.Current.MainWindow;
							confirmWin.ShowDialog();
							break;
						}
					default:
						break;
				}
			}
		}
 private void StackPanel_Click(object sender, RoutedEventArgs e)
 {
     if (e.Source is Button)
     {
         string name = (e.Source as Button).Name.ToString();
         switch (name)
         {
             case "ZoomIn"://放大
                 {
                     Camera currentCamera = SmObjectLocator.getInstance().GlobeObject.Scene.Camera;
                     currentCamera.Altitude *= 0.5;
                     SmObjectLocator.getInstance().GlobeObject.Scene.Fly(currentCamera,1000);
                     break;
                 }
             case "ZoomOut"://缩小
                 {
                     Camera currentCamera = SmObjectLocator.getInstance().GlobeObject.Scene.Camera;
                     currentCamera.Altitude /= 0.5;
                     SmObjectLocator.getInstance().GlobeObject.Scene.Fly(currentCamera,1000);
                     break;
                 }
             case "Stop"://停止
                 {
                     SmObjectLocator.getInstance().GlobeObject.Scene.StopFly();
                     break;
                 }
             case "FullExent"://全幅
                 {
                     SmObjectLocator.getInstance().GlobeObject.Scene.ViewEntire();
                     break;
                 }
             case "SearchLocation"://查询定位
                 {
                     //显示要素详情信息
                     //InformationWindow infoWin = new InformationWindow();
                     //infoWin.Topmost = true;
                     //infoWin.Owner = Application.Current.MainWindow; 
                     //infoWin.Show();
                     break;
                 }
             case "FullScreen"://全屏
                 {
                     WindowsHelper winHelper = new WindowsHelper();
                     if (this.WindowState == System.Windows.WindowState.Normal)
                     {
                         winHelper.adjustWindow(Application.Current.MainWindow, this, true);
                     }
                     else
                     {
                         winHelper.adjustWindow(Application.Current.MainWindow, this, false);
                     }
                     break;
                 }
             case "ExitSystem"://退出系统
                 {
                     ConfirmWindow confirmWin = new ConfirmWindow();
                     confirmWin.Owner = Application.Current.MainWindow;
                     confirmWin.ShowDialog();
                     break;
                 }
             default:
                 break;
         }
     }
 }