using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SuperMap.Data;
using SuperMap.Realspace;
using SuperMap.UI;
namespace 示例
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void MainForm_Load(object sender, EventArgs e)
{
sceneControl1.Scene.Workspace = workspace1;
}
private void button1_Click(object sender, EventArgs e)
{
WorkspaceConnectionInfo workspaceConnectionInfo = new WorkspaceConnectionInfo();
workspaceConnectionInfo.Server = @"E:\超图\1\SampleData\OSGB\MaSai.smwu";
workspaceConnectionInfo.Type = WorkspaceType.SMWU;//这个文件类型要与上面选取的文件相对应
//打开工作空间
bool isopen = workspace1.Open(workspaceConnectionInfo);//Open函数返回的是布尔变量
if(isopen)
{
//构造一个scene对象,从sceneControl1里面得到一个Scene对象
Scene scene = sceneControl1.Scene;
scene.Open("MaSai");//scene的Open方法参数常为场景名称
}
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
sceneControl1.Dispose();
workspace1.Dispose();
}
}
}