using System; using System.Collections.Generic; using System.Data; using System.Windows.Forms; using DevComponents.DotNetBar; using GeoScene.Globe; namespace Cyberpipe { public partial class FrmFittingQuery : Office2007Form { GSOGlobeControl globeControl1; List<string> layerNames = new List<string>(); static FrmFittingQuery frm; DataTable table = new DataTable(); string strLable = ""; private MainFrm.DataGridViewDelegate m_InitDataGridViewX1; public static void ShowForm(GSOGlobeControl _ctl, List<string> _list, MainFrm.DataGridViewDelegate InitDataGridViewX1) { if (frm == null) { frm = new FrmFittingQuery(_ctl, _list, InitDataGridViewX1); frm.Show(_ctl.Parent); } else { if (frm.WindowState == FormWindowState.Minimized) { frm.WindowState = FormWindowState.Normal; } } } public FrmFittingQuery(GSOGlobeControl _ctl, List<string> _list, MainFrm.DataGridViewDelegate InitDataGridViewX1) { InitializeComponent(); globeControl1 = _ctl; layerNames = _list; m_InitDataGridViewX1 = InitDataGridViewX1; } /// <summary> /// 查询按钮事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonX1_Click(object sender, EventArgs e) { try { if (comboBoxEx1.Text == "") { MessageBox.Show("请选择图层!", "提示"); return; } GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(comboBoxEx1.Text.Trim()); if (layer != null) { ClassSearchAnalysis.ResultDataTable(out table, globeControl1, comboBoxEx1.Text.Trim(), "", ""); if (table != null && table.Rows.Count > 0) { strLable = comboBoxEx1.Text + " 共有:" + table.Rows.Count + "个"; m_InitDataGridViewX1(table, strLable, comboBoxEx1.Text, true); } else { } } } catch (Exception ex) { LogHelper.WriteLog(typeof(FrmFittingQuery), ex.Message); } } /// <summary> /// 窗体初始化事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmFittingQuery_Load(object sender, EventArgs e) { for (int i = 0; i < layerNames.Count; i++) { if (layerNames[i].EndsWith("附属物") && !comboBoxEx1.Items.Contains(layerNames[i])) comboBoxEx1.Items.Add(layerNames[i]); } } /// <summary> /// 取消按钮事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonX3_Click(object sender, EventArgs e) { Close(); } /// <summary> /// 窗体关闭事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmFittingQuery_FormClosing(object sender, FormClosingEventArgs e) { m_InitDataGridViewX1(table, strLable, "", false); frm = null; } } }