首页 / 浏览问题 / 组件GIS / 问题详情
我加载的为示例文件为什么出现这种错误
5月8日, 2020

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();
}
}
}

1个回答

打开的时候代码直接 sceneControl1.Scene.Open("MaSai");
程逸诗  (4,429EXP)  名扬四海
5月8日, 2020

更改后还是这样如图

...