原文:利用WPF建立自己的3d gis软件(非axhost方式)(八)拖动一个UI到地球上
先下载SDK:https://pan.baidu.com/s/1M9kBS6ouUwLfrt0zV0bPew密码:1te1
地图数据包(sqlserver2008R2版本,也可以不下载):??https://pan.baidu.com/s/1PjcNamad7OVpCrsVJ7dwFQ 密码:uw9r
下载 核心SDK升级包:https://pan.baidu.com/s/1Q3dlM-Va-RmlEYbnmi8Xuw?并覆盖到SDK目录中。里面有也每一篇的例子代码
完整的视频演示:http://v.youku.com/v_show/id_XMTU4MTI5NTE4NA==.html
下载完成以后,解压出来,将30-1.exe 拖动到?把授权拖到我上面install.bat上完成授权安装。。。
?
设置system.ini 如下内容
Server=122.112.229.220
user=GisTest
Password=chinamtouch.com
该数据库中只提供 成都市火车南站附近的数据请注意,104.0648,30.61658
?
这次我们完成的功能为拖动一个外部的UI对象到球球上:
private void Button_PreviewMouseMove(object sender, MouseEventArgs e)
{
if(e.LeftButton== MouseButtonState.Pressed)
DragDrop.DoDragDrop((Button)sender, sender, DragDropEffects.Move);
}
private void Gis3d_PreviewDrop(object sender, DragEventArgs e)
{
if (e.Data.GetData(typeof(Button)) != null)
{
MTGIS3D Pareant = ((MTGIS3D)IniRead.IniReadWrite.MPareant);
GisLib.GIS2D.UserCanvas y1 = new GisLib.GIS2D.UserCanvas();
Point3D va = ((MTGIS3D)IniRead.IniReadWrite.MPareant).GetJWForMouse(e.GetPosition(Pareant));
Button Data = (Button)e.Data.GetData(typeof(Button));
Button Y1 = new Button();
Y1.Content=Data.Content;
Y1.Width = Data.Width;
Y1.Height = Data.Height;
NewGisBiao.M3D.UserGisUI3dObject2 JuLiSechBiao = new NewGisBiao.M3D.UserGisUI3dObject2(); //新建一个承载UI对象的东东
JuLiSechBiao.PareantEarth = (NewGisBiao.Base.GISInterfaseForBiao)IniRead.IniReadWrite.MPareant;//设置它的GIS球对象
JuLiSechBiao.Manage = IniRead.IniReadWrite.BiaoManage;//设置它的标号管理器
JuLiSechBiao.MaxZoom = 9;//最大显示层,当小于9层的时候不显示
JuLiSechBiao.MUIValue = Y1;//UI对象
JuLiSechBiao.DHi = 0.01;//相对于地形的高度
JuLiSechBiao.ZScal = 0.6;//相对缩放
JuLiSechBiao.Scal.ScaleX = 1; //固定东东
JuLiSechBiao.Scal.ScaleY = 1;
JuLiSechBiao.Scal.ScaleZ = 1;
JuLiSechBiao.AutoScal = true;//是否自动缩放,不管在哪一层都是一样大
JuLiSechBiao.AutoAngle = true;//是否自动角度,使终对着摄像机
JuLiSechBiao.CenterType = JunBiao.CenteType.左下角;//中心点类型
IniRead.IniReadWrite.BiaoManage.AddJunBiao(JuLiSechBiao);//增加到军标管理对象中。也可以不加
JuLiSechBiao.MWidth = Data.Width;//三维面片的大小
JuLiSechBiao.MHeight = Data.Height;
JuLiSechBiao.MRX = 90;
if (IniRead.IniReadWrite.MPareant is MTGIS3D) //手动刷新一下自动角度。。。bug
{
((MTGIS3D)IniRead.IniReadWrite.MPareant).TextAxisAngleX.Angle += 0.001;
((MTGIS3D)IniRead.IniReadWrite.MPareant).TextAxisAngleX.Angle -= 0.001;
}
JuLiSechBiao.Center = new Point(va.X, va.Y);//设置中心点
JuLiSechBiao.ISShow = true;//显示
}
}
?
效果 如下:
http://www.chinamtouch.com QQ:40140203
原文地址:https://www.cnblogs.com/lonelyxmas/p/10218590.html
时间: 2024-09-30 15:02:32