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; GSODataSource sgDs = null; GSODataSource scDs = null; GSOGlobeControl globeControl1 = null; GSOGlobeControl globeControl2 = null; GSOLayer layerTemp; GSOLayer layerTemp2; public FrmGBJC(GSOGlobeControl _globeControl1,GSOGlobeControl _globeControl2, GSOLayer _layerTemp,GSOLayer _layerTemp2) { this.globeControl1 = _globeControl1; this.globeControl2 = _globeControl2; DoublePanelAnalysis.globeControl1 = globeControl1; DoublePanelAnalysis.globeControl2 = globeControl2; this.layerTemp = _layerTemp; this.layerTemp2 = _layerTemp2; InitializeComponent(); } private void FrmGBJC_Load(object sender, EventArgs e) { //填充施工数据列表 sgIp = Utility.sgdbip; sgDb = Utility.sgdbname; sgUser = Utility.sgdbuser; sgPwd = Utility.sgdbpwd; sgDs = globeControl1.Globe.DataManager.OpenOracleDataSource(sgIp + "/" + sgDb, "", "", sgUser, sgPwd); if (sgDs == null) MessageBox.Show("施工数据库连接失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); for (int i = 0; i < sgDs.DatasetCount; i++) { GSODataset sgDt = sgDs.GetDatasetAt(i); if (sgDt.Name.ToLower().Contains("network")) continue; if (!sgDt.Name.ToLower().EndsWith("管线")) continue; if (!sgDt.Name.Contains("给水") && !sgDt.Name.Contains("雨水") && !sgDt.Name.Contains("污水") && !sgDt.Name.Contains("雨污") && !sgDt.Name.Contains("燃气") && !sgDt.Name.Contains("电力")) continue; if (sgDt.Name.Contains("SH")) continue; listBoxSG.Items.Add(sgDt.Name); } //填充实测数据列表 scDs = Utility.dataSource; if (scDs == null) MessageBox.Show("实测数据库连接未成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); for (int j = 0; j < scDs.DatasetCount; j++) { GSODataset scDt = scDs.GetDatasetAt(j); if (scDt.Name.ToLower().Contains("network")) continue; if (!scDt.Name.ToLower().EndsWith("管线")) continue; if (!scDt.Name.Contains("给水") && !scDt.Name.Contains("雨水") && !scDt.Name.Contains("污水") && !scDt.Name.Contains("雨污") && !scDt.Name.Contains("燃气") && !scDt.Name.Contains("供电")) continue; listBoxSC.Items.Add(scDt.Name); } for (int i = 0; i < listBoxSC.Items.Count; i++) { GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(listBoxSC.Items[i].ToString()); GSOFeatures fs = layer.GetAllFeatures(); for (int j = 0; j < fs.Length; j++) { string road = fs[j].GetFieldAsString("所属道路"); if (!comboBoxRoad.Items.Contains(road) && road != "") comboBoxRoad.Items.Add(road); } } } /// <summary> /// 施工图层列表点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void listBoxSG_SelectedIndexChanged(object sender, EventArgs e) { if (listBoxSG.SelectedItem == null) return; textBoxSG.Text = listBoxSG.SelectedItem.ToString(); } /// <summary> /// 实测图层列表点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void listBoxSC_SelectedIndexChanged(object sender, EventArgs e) { if (listBoxSC.SelectedItem == null) return; textBoxSC.Text = listBoxSC.SelectedItem.ToString(); } /// <summary> /// 确定检测 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonOK_Click(object sender, EventArgs e) { if (textBoxSC.Text.Trim() == "") { MessageBox.Show("请选择实测管线图层!", "提示"); return; } else if (textBoxSG.Text.Trim() == "") { MessageBox.Show("请选择施工图层!", "提示"); return; } else if (comboBoxRoad.SelectedItem == null) { MessageBox.Show("请选择道路!", "提示"); return; } else { GSOLayer scLayer = globeControl1.Globe.Layers.GetLayerByCaption(textBoxSC.Text.ToString()); GSOLayer sgLayer = globeControl2.Globe.Layers.GetLayerByCaption(textBoxSG.Text.ToString()); if (scLayer == null || sgLayer == null) return; DataTable dt = DoublePanelAnalysis.lineFeatureCompare(scLayer, sgLayer, comboBoxRoad.SelectedItem.ToString()); for (int i = 0; i < scLayer.GetAllFeatures().Length; i++) { GSOFeature feature = scLayer.GetAt(i); } FrmGBJCresult rs = new FrmGBJCresult(globeControl1, globeControl2, dt, layerTemp, layerTemp2); rs.Show(); this.Close(); } } } }