Add supergraph scene control to WPF

Add citation

Since the supermap control is a Winform, it cannot be added directly in WPF. It needs to be placed in the container to display normally, and the two assemblies in the figure below need to be referenced.
Add citation

XAML

Quote

xmlns:wfi ="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"

Winform container

<wfi:WindowsFormsHost x:Name="hostSceneControl"></wfi:WindowsFormsHost>
CS code
private Workspace m_workspace;
private SceneControl m_sceneControl;

m_workspace = new Workspace();
m_sceneControl = new SceneControl(SuperMap.Realspace.SceneType.Globe);
hostSceneControl.Child = m_sceneControl;

m_sceneControl.SendToBack();

string path = @"‪‪******.smwu";
if (File.Exists(path))
{
    
    
    m_sceneControl.Scene.Workspace = m_workspace;
    m_workspace.Open(new WorkspaceConnectionInfo(path));
    m_sceneControl.Scene.Open("World");
}

exit the program

退出时需要释放资源

if (m_sceneControl != null)
{
    
    
    m_sceneControl.Scene.Close();
    m_sceneControl.Dispose();
    m_sceneControl = null;
}

Guess you like

Origin blog.csdn.net/qq_29242649/article/details/109214824