using SuperMap.Data;
using SuperMap.Mapping;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SuperMap.Layout;
using SuperMap.UI;
using SuperMap.Desktop;
using SuperMap.Realspace;
using Application = SuperMap.Desktop.Application;
namespace zudonghua0705
{
public partial class Form1 : Form
{
//打开工作空间
IFormMap m_activefrm = SuperMap.Desktop.Application.ActiveApplication.MainForm.FormManager.ActiveForm as IFormMap;
Workspace workspace = new Workspace();
IFormMap formmap = SuperMap.Desktop.Application.ActiveForm as IFormMap;
int xq = 1;
public Form1()
{
InitializeComponent();
}
public void Form1_Load(object sender, EventArgs e)
{
String sceneName = "界面";
WorkspaceConnectionInfo wsInfo = new WorkspaceConnectionInfo(@"D:/SuperMap/规划平台/SampleData/zhangjiajie/澧水流域1.smwu");
if (Application.ActiveApplication.Workspace.Open(wsInfo))
{
//打开场景
IFormScene sceneForm = Application.ActiveApplication.CreateSceneWindow();
m_currentScene = sceneForm.SceneControl.Scene;
if (m_currentScene.Open(sceneName))
{
(sceneForm as Form).Text = sceneName;
}
}
}
private Scene m_currentScene;
private void Timer1_Tick(object sender, EventArgs e)
{
if (xq < 10)
{
Datasource datasource = workspace.Datasources[0];
Dataset dataset = datasource.Datasets[xq];
Layers layers = m_activefrm.MapControl.Map.Layers;
layers.Add(dataset,true);
Layer layer = m_activefrm.MapControl.Map.Layers.Add(dataset, true);
m_activefrm.MapControl.Map.Refresh();
xq = xq + 1;
}
else
{
timer1.Stop();
timer1.Tick -= Timer1_Tick;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
timer1.Interval = 1000;
timer1.Start();
timer1.Tick += Timer1_Tick;
}
private void button2_Click(object sender, EventArgs e)
{
timer1.Stop();
timer1.Tick -= Timer1_Tick;
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void label1_Click(object sender, EventArgs e)
{
}
}
}