超圖獲取檔案資料集資料
阿新 • • 發佈:2019-02-19
String wksPath = @"E:\guibao\project\前灘進度管理系統\data\superMap\BSDATA\q2JinduBimScene\qtQ2JinduBim.smwu";
WorkspaceConnectionInfo connInfo = new WorkspaceConnectionInfo(wksPath);
this.workspace = new SuperMap.Data.Workspace(this.components);
this.workspace.Caption = "UntitledWorkspace";
this.workspace.Description = "";
bool bOpen = workspace.Open(connInfo);
if (!bOpen)
{
MessageBox.Show("開啟工作空間失敗!");
}
Datasource m_datasource = workspace.Datasources[1];
Scene scene = this.m_sceneControl.Scene;
scene.Workspace = workspace;
bOpen = scene.Open("q2JinduBim");
if (!bOpen)
{
MessageBox.Show("開啟場景失敗!");
}
Layer3DDataset L3D = null;
foreach (Layer3D kv in this.m_sceneControl.Scene.Layers)
{
if (kv.Name.IndexOf("BimQEjps")>-1)
{
L3D = kv as Layer3DDataset;
break;
}
}
DatasetVector dv = L3D.Dataset as DatasetVector;
//wataerQuality
Rd = dv.GetRecordset(false, CursorType.Dynamic);
Editor = Rd.Batch;
Editor.MaxRecordCount = 100;
Editor.Begin();
while (!Rd.IsEOF)
{
//Dictionary<string, object> dataMap = new Dictionary<string, object>();
//double radPh = 7.4 + random.Next(-5, 5) * 1.0 / 100.0;
//dataMap.Add("PH", radPh);
//double radCOD = 10.0 + random.Next(-4, 4) * 1.0 / 10.0;
//dataMap.Add("COD", radCOD);
//double radBOD = 23.3 + random.Next(-6, 5) * 1.0 / 10.0;
//dataMap.Add("BOD", radBOD);
//string tip = @"PH:" + radPh + "\nCOD: " + radCOD + @" mg/L\nBOD: " + radBOD + " mg/L";
//dataMap.Add("Tip", tip);
object[] objs = Rd.GetValues();
Rd.MoveNext();
}
// 批量操作統一提交
Editor.Update();
L3D.UpdateData();
// 釋放記錄
Rd.Dispose();
WorkspaceConnectionInfo connInfo = new WorkspaceConnectionInfo(wksPath);
this.workspace = new SuperMap.Data.Workspace(this.components);
this.workspace.Caption = "UntitledWorkspace";
this.workspace.Description = "";
bool bOpen = workspace.Open(connInfo);
if (!bOpen)
{
MessageBox.Show("開啟工作空間失敗!");
}
Datasource m_datasource = workspace.Datasources[1];
Scene scene = this.m_sceneControl.Scene;
scene.Workspace = workspace;
bOpen = scene.Open("q2JinduBim");
if (!bOpen)
{
MessageBox.Show("開啟場景失敗!");
}
Layer3DDataset L3D = null;
foreach (Layer3D kv in this.m_sceneControl.Scene.Layers)
{
if (kv.Name.IndexOf("BimQEjps")>-1)
{
L3D = kv as Layer3DDataset;
break;
}
}
DatasetVector dv = L3D.Dataset as DatasetVector;
//wataerQuality
Rd = dv.GetRecordset(false, CursorType.Dynamic);
Editor = Rd.Batch;
Editor.MaxRecordCount = 100;
Editor.Begin();
while (!Rd.IsEOF)
{
//Dictionary<string, object> dataMap = new Dictionary<string, object>();
//double radPh = 7.4 + random.Next(-5, 5) * 1.0 / 100.0;
//dataMap.Add("PH", radPh);
//double radCOD = 10.0 + random.Next(-4, 4) * 1.0 / 10.0;
//dataMap.Add("COD", radCOD);
//double radBOD = 23.3 + random.Next(-6, 5) * 1.0 / 10.0;
//dataMap.Add("BOD", radBOD);
//string tip = @"PH:" + radPh + "\nCOD: " + radCOD + @" mg/L\nBOD: " + radBOD + " mg/L";
//dataMap.Add("Tip", tip);
object[] objs = Rd.GetValues();
Rd.MoveNext();
}
// 批量操作統一提交
Editor.Update();
L3D.UpdateData();
// 釋放記錄
Rd.Dispose();