M3DGIS三维电子沙盘开发教程第52课无人机倾斜摄影全景三维建模

本文档展示了如何设置system.ini文件,并利用三方工具生成PNG序列,结合C# WPF创建一个UserControl来动态显示这些序列图片。通过调整特定属性实现粒子显示效果,同时在主程序中应用该效果,将UI对象添加到GIS系统中,实现地图上的动态粒子显示。此方法适用于GIS应用中的动态元素展示。
摘要由CSDN通过智能技术生成

设置system.ini 如下内容
Server=122.112.229.220
user=GisTest
Password=chinamtouch.com

该数据库中只提供 成都市火车南站附近的数据请注意,104.0648,30.61658

利用三方工具,如幻影粒子:

或者flash一类的工具生成如下的PNG序列:

然后下面利 用https://blog.csdn.net/xtgmd168/article/details/85264680 中所介绍的方法。将它变成一个简单的粒子显示元素:

新建一个UserControl完成序列PNG的动态显示:

AmiImage.xaml

 
  1. <UserControl x:Class="Teach3DGIS.AmiImage"

  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

  6. xmlns:local="clr-namespace:Teach3DGIS"

  7. mc:Ignorable="d"

  8. Height="450" Width="800">

  9.  
  10. </UserControl>

AmiImage.cs

 
  1. using System;

  2. using System.Collections.Generic;

  3. using System.Linq;

  4. using System.Text;

  5. using System.Threading.Tasks;

  6. using System.Windows;

  7. using System.Windows.Controls;

  8. using System.Windows.Data;

  9. using System.Windows.Documents;

  10. using System.Windows.Input;

  11. using System.Windows.Media;

  12. using System.Windows.Media.Imaging;

  13. using System.Windows.Navigation;

  14. using System.Windows.Shapes;

  15. using System.IO;

  16.  
  17. namespace Teach3DGIS

  18. {

  19. /// <summary>

  20. /// AmiImage.xaml 的交互逻辑

  21. /// </summary>

  22. public partial class AmiImage : UserControl

  23. {

  24. public AmiImage()

  25. {

  26. InitializeComponent();

  27. }

  28. private List<string> FileList = new List<string>();

  29. private System.Windows.Threading.DispatcherTimer ATimer;

  30. private int index = 0;

  31. public AmiImage(string Path)

  32. {

  33. InitializeComponent();

  34. DirectoryInfo v1 = new DirectoryInfo(Path);

  35. foreach(FileInfo V2 in v1.GetFiles("*.png"))

  36. {

  37. FileList.Add(V2.FullName);

  38. }

  39. ATimer = new System.Windows.Threading.DispatcherTimer();

  40. ATimer.Tick += ATimer_Tick;

  41. ATimer.Interval = new TimeSpan(0, 0, 0, 0,5);

  42. ATimer.Start();

  43. }

  44.  
  45. private void ATimer_Tick(object sender, EventArgs e)

  46. {

  47. this.Background = new ImageBrush(new BitmapImage(new Uri(FileList[index])));

  48. index++;

  49. if (index == FileList.Count - 1)

  50. index = 0;

  51. }

  52. }

  53. }

主程序中代码如下:

 
  1. private void Button_Click_9(object sender, RoutedEventArgs e)

  2. {

  3. gis3d.GetJWEvent += Gis3d_GetJWEvent1;

  4. gis3d.State = GisLib.WindowsMT.GisState.获取经纬度;

  5.  
  6.  
  7. }

  8.  
  9. private void Gis3d_GetJWEvent1(System.Windows.Media.Media3D.Point3D value)

  10. {

  11. gis3d.GetJWEvent -= Gis3d_GetJWEvent;

  12. gis3d.State = GisLib.WindowsMT.GisState.漫游;

  13.  
  14. AmiImage y1 = new AmiImage(AppDomain.CurrentDomain.BaseDirectory + "a");

  15.  
  16.  
  17.  
  18. NewGisBiao.M3D.UserGisUI3dObject2 JuLiSechBiao = new NewGisBiao.M3D.UserGisUI3dObject2(); //新建一个承载UI对象的东东

  19. JuLiSechBiao.PareantEarth = (NewGisBiao.Base.GISInterfaseForBiao)IniRead.IniReadWrite.MPareant;//设置它的GIS球对象

  20. JuLiSechBiao.Manage = IniRead.IniReadWrite.BiaoManage;//设置它的标号管理器

  21.  
  22. JuLiSechBiao.MaxZoom = 9;//最大显示层,当小于9层的时候不显示

  23.  
  24. JuLiSechBiao.MUIValue = y1;//UI对象

  25.  
  26. JuLiSechBiao.DHi = 0.01;//相对于地形的高度

  27. JuLiSechBiao.ZScal = 0.6;//相对缩放

  28. JuLiSechBiao.Scal.ScaleX = 1; //固定东东

  29. JuLiSechBiao.Scal.ScaleY = 1;

  30. JuLiSechBiao.Scal.ScaleZ = 1;

  31.  
  32. JuLiSechBiao.AutoScal = true;//是否自动缩放,不管在哪一层都是一样大

  33. JuLiSechBiao.AutoAngle = true;//是否自动角度,使终对着摄像机

  34. JuLiSechBiao.CenterType = JunBiao.CenteType.左下角;//中心点类型

  35. IniRead.IniReadWrite.BiaoManage.AddJunBiao(JuLiSechBiao);//增加到军标管理对象中。也可以不加

  36. JuLiSechBiao.MWidth = 250;//三维面片的大小

  37. JuLiSechBiao.MHeight = 150;

  38. JuLiSechBiao.MRX = 90;

  39. if (IniRead.IniReadWrite.MPareant is MTGIS3D) //手动刷新一下自动角度。。。bug

  40. {

  41. ((MTGIS3D)IniRead.IniReadWrite.MPareant).TextAxisAngleX.Angle += 0.001;

  42. ((MTGIS3D)IniRead.IniReadWrite.MPareant).TextAxisAngleX.Angle -= 0.001;

  43. }

  44.  
  45.  
  46. JuLiSechBiao.Center = new Point(value.X, value.Y);//设置中心点

  47.  
  48. JuLiSechBiao.ISShow = true;//显示

  49.  
  50. }

 

 

效果如下:

当然有一些效果是平贴在地上的,如光圈效果等:如下:

这里很明显就是用了两个对象,两个UI。其中一个UI的autoangle为false再通过调整 MRX MRY 设置一个死的角度就成上面这样了。效果还不错吧。WPF可以让我们尽情的发挥UI的优势。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值