osgb示例数据MaSai导入iobjects但不能显示,点击加载场景之后不能显示数据,如下图:
我的代码如下:
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 baimiao1
{
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:\白云逸_CRUCIAL\白云逸开发\supermap-iobjectsdotnet-9.1.2-17224-71949-all\SampleData\OSGB\MaSai.smwu";
//2.Type为,是workspace类的另一个一个属性
workspaceConnectionInfo.Type = WorkspaceType.SMWU;//这个文件类型要与上面选取的文件相对应
//打开工作空间
bool isopen = workspace1.Open(workspaceConnectionInfo);//Open函数返回的是布尔变量
if(isopen)
{
//构造一个scene对象,从sceneControl1里面得到一个Scene对象
Scene scene = sceneControl1.Scene;
scene.Open("MaSai");//scene的Open方法参数常为场景名称
scene.ViewEntire();
}
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
sceneControl1.Dispose();
workspace1.Dispose();
}
}
}
谢谢