利用WPF建立自己的3d gis软件(非axhost方式)(五)在鼠标点击的位置增加UI
先下載SDK:https://pan.baidu.com/s/1M9kBS6ouUwLfrt0zV0bPew 密碼:1te1
地圖數(shù)據(jù)包(sqlserver2008R2版本,也可以不下載):? https://pan.baidu.com/s/1PjcNamad7OVpCrsVJ7dwFQ 密碼:uw9r
下載 核心SDK升級(jí)包:https://pan.baidu.com/s/1Q3dlM-Va-RmlEYbnmi8Xuw?并覆蓋到SDK目錄中。里面有也每一篇的例子代碼
下載完成以后,解壓出來(lái),將30-1.exe 拖動(dòng)到?把授權(quán)拖到我上面install.bat上完成授權(quán)安裝。。。
?
設(shè)置system.ini 如下內(nèi)容
Server=122.112.229.220
user=GisTest
Password=chinamtouch.com
該數(shù)據(jù)庫(kù)中只提供 成都市火車(chē)南站附近的數(shù)據(jù)請(qǐng)注意,104.0648,30.61658
在鼠標(biāo)指定的位置增加自己的UI對(duì)象:
?代碼如下:
private void Button_Click_6(object sender, RoutedEventArgs e){gis3d.GetJWEvent += Gis3d_GetJWEvent;gis3d.State = GisLib.WindowsMT.GisState.獲取經(jīng)緯度;}private void Gis3d_GetJWEvent(System.Windows.Media.Media3D.Point3D value){gis3d.GetJWEvent -= Gis3d_GetJWEvent;gis3d.State = GisLib.WindowsMT.GisState.漫游;Callout MyCallOut = new Callout();MyCallOut.Width = 300;MyCallOut.Height = 200;MyCallOut.BorderBrush = new SolidColorBrush(Colors.White);MyCallOut.Background = new SolidColorBrush(Colors.Blue);MyCallOut.Stroke = new SolidColorBrush(Colors.Black);MyCallOut.Fill = new SolidColorBrush(Color.FromArgb(100, 0, 0, 0));MyCallOut.AnchorPoint = new Point(0, 2);MyCallOut.StrokeThickness = 2;NewGisBiao.M3D.UserGisUI3dObject2 JuLiSechBiao = new NewGisBiao.M3D.UserGisUI3dObject2(); //新建一個(gè)承載UI對(duì)象的東東JuLiSechBiao.PareantEarth = (NewGisBiao.Base.GISInterfaseForBiao)IniRead.IniReadWrite.MPareant;//設(shè)置它的GIS球?qū)ο驤uLiSechBiao.Manage = IniRead.IniReadWrite.BiaoManage;//設(shè)置它的標(biāo)號(hào)管理器JuLiSechBiao.MaxZoom = 9;//最大顯示層,當(dāng)小于9層的時(shí)候不顯示JuLiSechBiao.MUIValue = MyCallOut;//UI對(duì)象JuLiSechBiao.DHi = 0.01;//相對(duì)于地形的高度JuLiSechBiao.ZScal = 0.2;//相對(duì)縮放JuLiSechBiao.Scal.ScaleX = 1; //固定東東JuLiSechBiao.Scal.ScaleY = 1;JuLiSechBiao.Scal.ScaleZ = 1;JuLiSechBiao.AutoScal = true;//是否自動(dòng)縮放,不管在哪一層都是一樣大JuLiSechBiao.AutoAngle = true;//是否自動(dòng)角度,使終對(duì)著攝像機(jī)JuLiSechBiao.CenterType = JunBiao.CenteType.左下角;//中心點(diǎn)類(lèi)型IniRead.IniReadWrite.BiaoManage.AddJunBiao(JuLiSechBiao);//增加到軍標(biāo)管理對(duì)象中。也可以不加JuLiSechBiao.MWidth = 250;//三維面片的大小JuLiSechBiao.MHeight = 150;JuLiSechBiao.MRX = 90;if (IniRead.IniReadWrite.MPareant is MTGIS3D) //手動(dòng)刷新一下自動(dòng)角度。。。bug{((MTGIS3D)IniRead.IniReadWrite.MPareant).TextAxisAngleX.Angle += 0.001;((MTGIS3D)IniRead.IniReadWrite.MPareant).TextAxisAngleX.Angle -= 0.001;}JuLiSechBiao.Center = new Point(value.X, value.Y);//設(shè)置中心點(diǎn)JuLiSechBiao.ISShow = true;//顯示}?
效果如下:
?
http://www.chinamtouch.com ?QQ:40140203
總結(jié)
以上是生活随笔為你收集整理的利用WPF建立自己的3d gis软件(非axhost方式)(五)在鼠标点击的位置增加UI的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Laravel项目上传github后,c
- 下一篇: C#的常见算法(面试)(转)