using System; using System.Data; using System.Windows.Forms; using DevComponents.DotNetBar; using GeoScene.Data; using GeoScene.Engine; using GeoScene.Globe; namespace Cyberpipe { public partial class FrmGBJC : Office2007Form { string sgIp, sgDb, sgUser, sgPwd; GSOGlobeControl globeControl1 = null; GSOGlobeControl globeControl2 = null; public FrmGBJC(GSOGlobeControl _globeControl1,GSOGlobeControl _globeControl2) { this.globeControl1 = _globeControl1; this.globeControl2 = _globeControl2; InitializeComponent(); } void addListBox(GSODataSource ds,ListBox lt) { if (ds == null) { MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } for (int i = 0; i < ds.DatasetCount; i++) { GSODataset dt = ds.GetDatasetAt(i); if (dt.Name.ToLower().Contains("network") || !dt.Name.ToLower().EndsWith("管线") || dt.Name.Contains("SH") || dt.Name.Contains("SLS")) continue; /* if (!dt.Name.Contains("给水") && !dt.Name.Contains("雨水") && !dt.Name.Contains("污水") && !dt.Name.Contains("雨污") && !dt.Name.Contains("燃气") && !dt.Name.Contains("电力")) continue; * */ lt.Items.Add(dt.Name); } } private void FrmGBJC_Load(object sender, EventArgs e) { //填充施工数据列表 sgIp = Utility.sgdbip; sgDb = Utility.sgdbname; sgUser = Utility.sgdbuser; sgPwd = Utility.sgdbpwd; GSODataSource sgDs = globeControl1.Globe.DataManager.OpenOracleDataSource(sgIp + "/" + sgDb, "", "", sgUser, sgPwd); addListBox(sgDs, listBoxSG); //填充实测数据列表 GSODataSource scDs = Utility.dataSource; addListBox(scDs, listBoxSC); } private void listBoxSG_SelectedIndexChanged(object sender, EventArgs e) { if (listBoxSG.SelectedItem == null) return; textBoxSG.Text = listBoxSG.SelectedItem.ToString(); } private void listBoxSC_SelectedIndexChanged(object sender, EventArgs e) { if (listBoxSC.SelectedItem == null) return; textBoxSC.Text = listBoxSC.SelectedItem.ToString(); addRoadNameToListBox(); } void addRoadNameToListBox() { comboBoxRoad.Items.Clear(); DataTable table = new DataTable(); ClassSearchAnalysis.ResultDistinctDataTable(out table,textBoxSC.Text,"所属道路"); comboBoxRoad.Items.Add("无"); for (int i = 0; i < table.Rows.Count; i++) { DataRow dr = table.Rows[i]; string colString1 = dr[0].ToString(); if (colString1 == null || colString1.Trim() == "") continue; comboBoxRoad.Items.Add(colString1); } } private bool InvalParam() { if (textBoxSC.Text.Trim().Equals("")) { MessageBox.Show("请选择实测管线图层!", "提示"); return false; } if (textBoxSG.Text.Trim().Equals("")) { MessageBox.Show("请选择施工图层!", "提示"); return false; } if (comboBoxRoad.SelectedItem == null) { MessageBox.Show("请选择道路!", "提示"); return false; } return true; } private void buttonOK_Click(object sender, EventArgs e) { bool isvalid = InvalParam(); if (!isvalid) return; GSOLayer scLayer = globeControl1.Globe.Layers.GetLayerByCaption(textBoxSC.Text); GSOLayer sgLayer = globeControl2.Globe.Layers.GetLayerByCaption(textBoxSG.Text); if (scLayer == null || sgLayer == null) return; DataTable dt = DoublePanelAnalysis.CompareLayerByRoad(scLayer, sgLayer, comboBoxRoad.SelectedItem.ToString(), globeControl1, globeControl2); FrmGBJCresult rs = new FrmGBJCresult(globeControl1, globeControl2, dt); rs.Show(); this.Close(); } } }