using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SuperMap.Data;
using SuperMap.Realspace;
using SuperMap.UI;
namespace Import_CBD
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
}
public Workspace m_workspace;
public SceneControl m_sceneControl;
private void MainForm_Load(object sender, EventArgs e)
{
// 打开工作空间,取出工作空间中名为“CBD场景”的数据集,查询其描述信息
m_workspace = new SuperMap.Data.Workspace(this.components);
m_sceneControl = new SuperMap.UI.SceneControl();
m_sceneControl.Dock = DockStyle.Fill;
panel1.Dock = DockStyle.Fill;
panel1.Controls.Add(m_sceneControl);
WorkspaceConnectionInfo workspaceConnectionInfo = new WorkspaceConnectionInfo();
workspaceConnectionInfo.Type = WorkspaceType.SMWU;
//String file = @"F:\B16\SampleData\CBD\CBDCache.smwu";
String file = @"../../../../../CBD/CBDCache.smwu";
workspaceConnectionInfo.Server = file;
m_workspace.Open(workspaceConnectionInfo);
m_sceneControl.Scene.Open("CBD场景");
//FlyToModel(116.275357,39.544252,12.4495723647997, 0.0729635336123907, 82.6250751109261);
FlyToModel(116.275357, 39.544252, 12.449572, 0.072963, 82.625075);
// 保存工作空间
m_workspace.Save();
}
public void FlyToModel(double dL, double dB, double dA, double dH, double dT)
{
Camera camera = new Camera();
camera.Longitude = dL;
camera.Latitude = dB;
camera.Altitude = dA;
camera.Heading = dH;
camera.Tilt = dT;
m_sceneControl.Scene.Fly(camera, 1000);
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
if(m_sceneControl != null)
{
m_sceneControl.Dispose();
}
if (m_workspace != null)
{
m_workspace.Dispose();
}
}
}
}