如何将Skyline66嵌入WPF中

Posted huangwei1992

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何将Skyline66嵌入WPF中相关的知识,希望对你有一定的参考价值。

1.新建WPF项目;

2.添加引用

.net引用:System.Windows.Forms和WindowsFormsIntegration

skyline引用:AxInterop.TerraExplorerX和TerraExplorerX

3.代码如下:

/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
private SGWorld66 sgWorld = null;
public MainWindow()
{
InitializeComponent();

WindowsFormsHost host = new WindowsFormsHost();
AxTerraExplorerX.AxTE3DWindow axTE3DWindow1 = new AxTerraExplorerX.AxTE3DWindow();
host.Child = axTE3DWindow1;
this.globeWindow.Children.Add(host);

this.globeWindow.Loaded += GlobeWindow_Loaded;
}

private void GlobeWindow_Loaded(object sender, RoutedEventArgs e)
{
this.OpenProject();
}

private void OpenProject()
{
string tMsg = String.Empty;
// A. Set Project "Open" Method parameters
string tProjectUrl = @"D:软件开发Skyline使用的FlyDefault.fly";

bool bIsAsync = false;
string tUser = String.Empty;
string tPassword = String.Empty;
// B. Instantiate Terra Explorer Globe and retrieve Project Interface

try
{
sgWorld = new SGWorld66();
// D. Open Project in synchronous mode
sgWorld.Project.Open(tProjectUrl, bIsAsync, tUser, tPassword);
}
catch (Exception ex)
{
tMsg = String.Format("OpenProjectButton_Click Exception: {0}", ex.Message);
MessageBox.Show(tMsg);
}
}

}


































以上是关于如何将Skyline66嵌入WPF中的主要内容,如果未能解决你的问题,请参考以下文章

skyline开发——读取Shapefile要素属性

skyline开发——加载Shapefile文件

如何通过C#开发调用Skyline软件中提供的小工具

skyline模拟器驱动选项灰色

如何在Skyline中加载ArcGISServer发布的WMS和WMTS服务

skyline的fly工程中引用数据路径修改