Esempio n. 1
0
        private void btAnalyse_Click(object obj, EventArgs eventArg)
        {
            double num = 0;

            if (this.tbBufferRadius.Text != "")
            {
                num = Convert.ToDouble(this.tbBufferRadius.Text);
            }
            this.btAnalyse.Enabled = false;
            this.Cursor            = Cursors.WaitCursor;
            try
            {
                this.chitAnalyse_0.BufferDistance = num;
                this.chitAnalyse_0.Analyse_Vertical();
                List <CHitAnalyse.CItem> items = this.chitAnalyse_0.Items;
                this.dataGridView1.Rows.Clear();
                DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle()
                {
                    BackColor = Color.Red
                };
                if (items.Count > 0)
                {
                    this.dataGridView1.Rows.Add(items.Count);
                    for (int i = 0; i < items.Count; i++)
                    {
                        CHitAnalyse.CItem item = items[i];
                        DataGridViewRow   str  = this.dataGridView1.Rows[i];
                        str.Tag = item._pClass;
                        int num1 = i + 1;
                        str.Cells[0].Value = num1.ToString();
                        str.Cells[1].Value = item._sKind;
                        str.Cells[2].Value = item._OID.ToString();
                        str.Cells[3].Value = item._dVerDistance.ToString("0.000");
                        if (item._dVerBase > 0.001)
                        {
                            str.Cells[4].Value = item._dVerBase.ToString("0.000");
                        }
                        if (item._dVerDistance < item._dVerBase)
                        {
                            str.Cells[3].Style = dataGridViewCellStyle;
                        }
                    }
                }
            }
            catch (Exception exception)
            {
            }
            this.Cursor            = Cursors.Default;
            this.btAnalyse.Enabled = true;
        }
Esempio n. 2
0
        private void btAnalyse_Click(object obj, EventArgs eventArg)
        {
            double num = Convert.ToDouble(this.tbBufferRadius.Text);

            this.btAnalyse.Enabled = false;
            this.Cursor            = Cursors.WaitCursor;
            IPolyline polyline = this.BuildAnalysisLine();
            string    text     = this.tbPipeWidthOrHeight.Text;

            if (!this.radioButton2.Checked)
            {
                this.chitAnalyse_0.SetData(text, polyline);
            }
            else
            {
                if (this.comboBoxGX.SelectedIndex < 0)
                {
                    MessageBox.Show("请选择管线层!");
                    this.Cursor            = Cursors.Default;
                    this.btAnalyse.Enabled = true;
                    return;
                }
                LayerInfo selectedItem = (LayerInfo)this.comboBoxGX.SelectedItem;
                this.chitAnalyse_0.SetData(text, polyline, selectedItem.FeatureLauer.FeatureClass);
            }
            try
            {
                this.chitAnalyse_0.IsMUsing       = cmbDepthType.SelectedIndex != 0;
                this.chitAnalyse_0.BufferDistance = num;
                this.chitAnalyse_0.Analyse_Hit();
                List <CHitAnalyse.CItem> items = this.chitAnalyse_0.Items;
                this.dataGridView1.Rows.Clear();
                DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle()
                {
                    BackColor = Color.Red
                };
                if (items.Count > 0)
                {
                    this.dataGridView1.Rows.Add(items.Count);
                    for (int i = 0; i < items.Count; i++)
                    {
                        CHitAnalyse.CItem item = items[i];
                        DataGridViewRow   str  = this.dataGridView1.Rows[i];
                        str.Tag            = item._pClass;
                        str.Cells[0].Value = i + 1;
                        str.Cells[1].Value = item._sKind;
                        str.Cells[2].Value = item._OID;
                        str.Cells[3].Value = item._dHorDistance.ToString("0.000");
                        if (item._dHorBase > 0.001)
                        {
                            str.Cells[4].Value = item._dHorBase.ToString("0.000");
                        }
                        str.Cells[5].Value = item._dVerDistance.ToString("0.000");
                        if (item._dVerBase > 0.001)
                        {
                            str.Cells[6].Value = item._dVerBase.ToString("0.000");
                        }
                        if (item._dHorDistance < item._dHorBase)
                        {
                            str.Cells[3].Style = dataGridViewCellStyle;
                        }
                        if (item._dVerDistance < item._dVerBase)
                        {
                            str.Cells[5].Style = dataGridViewCellStyle;
                        }
                    }
                }
            }
            catch (Exception exception)
            {
            }
            this.Cursor            = Cursors.Default;
            this.btAnalyse.Enabled = true;
        }