三维电子沙盘大数据人工智能模拟对抗推演系统开发教程第一课
该数据库中只提供 成都市火车南站附近的数据请注意,104.0648,30.61658
而且该公用服务器带宽不大,所以会有些卡顿,建议下载数据库后本地使用,下载后的数据库有些许变化,请联系博主修改一下
你下载了sql包。则设置为自己的设置。
下一步新建一个wpf工程。然后引用SDK中的gislib.dll,NewGisBiao.dll如下图:
下面上代码
<Window x:Class="Teach3DGIS.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Teach3DGIS"
mc:Ignorable="d"
Title="MainWindow" Height="768" Width="1024">
<Canvas x:Name="Root" Height="768" Width="1024">
</Canvas>
</Window>
MainWindow.cs
using GisLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Teach3DGIS
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
Init3D();
}
GisLib.MTGIS3D gis3d;
GisLib.MTGIS2 gis2d;
private void Init3D()
{
if (gis3d == null)
{
IniRead.IniReadWrite.BiaoManage = new NewGisBiao.Base.BiaoManage(Root);
gis3d = new MTGIS3D();
gis3d.TManage = IniRead.IniReadWrite.BiaoManage;
Root.Children.Add(gis3d);
Canvas.SetLeft(gis3d, 0);
Canvas.SetTop(gis3d, 0);
gis3d.Width = this.Width - 100;
gis3d.Height = this.Height - 100;
//高程数据目录及对象初始
// gis3d.WireLineSelect += Gis3d_WireLineSelect;
gis3d._HiMain = new GisLib.HiData.HiMang(AppDomain.CurrentDomain.BaseDirectory + "hidatatemp", "hi");
IniRead.IniReadWrite.MPareant = gis3d;
}
}
}
}
设置工程 输出目录为SDK所在目录如下图
然后运后就可以得到一个wpf版本的3dgis了:
由于是非axhost方式加入的,所以是完全支持WPF的特性的。我们可以将地图控件旋转一定角度:代码如下:
RotateTransform u1 = new RotateTransform();
u1.Angle = 45;
gis3d.RenderTransformOrigin = new Point(0.5, 0.5);
gis3d.RenderTransform = u1;
效果如下:
————————————————