Beispiel #1
0
        private void UpdateUI(ILayer m_Layer)
        {
            m_gridfield.AutoGenerateColumns = true;
            m_barTable.Show();
            int nItemCount = m_barTable.Items.Count;

            for (int i = 0; i < nItemCount; i++)
            {
                m_barTable.Items[i].Visible = true;
            }
            m_barTable.Invalidate();
            m_btnshowallout.Visible  = true;
            m_btnshowselout.Visible  = true;
            m_btntable.Visible       = true;
            m_btnselras.Visible      = true;
            m_btnselallras.Visible   = false;
            m_btnaddfield.Visible    = true;
            m_btnswitchras.Visible   = false;
            m_btnselclear.Visible    = false;
            m_toolbarfield.Visible   = true;
            m_btnhide.Visible        = true;
            m_showall.Visible        = true;
            m_showsel.Visible        = true;
            m_btndelectfield.Visible = true;
            m_gridfield.CurrentCell  = null;
            m_barTable.Text          = m_Layer.Name;
            m_docktable.Text         = m_Layer.Name;
        }
Beispiel #2
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            ITable pTableR = (ITable)pLayer;
            ITable pTableJ = (ITable)pJoinLayer;
            IField pField  = new FieldClass();

            m_AttributeTable = new System.Data.DataTable();
            for (int i = 0; i < pTableR.Fields.FieldCount; i++)
            {
                m_AttributeTable.Columns.Add();
                m_AttributeTable.Columns[i].ColumnName = pTableR.Fields.Field[i].Name;
            }
            for (int k = 0; k < pTableJ.Fields.FieldCount; k++)
            {
                //pField = pTableJ.Fields.Field[k];
                //pTableR.AddField(pField);
                m_AttributeTable.Columns.Add();
                m_AttributeTable.Columns[pTableR.Fields.FieldCount + k].ColumnName = pTableJ.Fields.Field[k].Name + "*";
            }

            if (chkall.Checked == true)
            {
                IRow    row    = null;
                ICursor cursor = pTableR.Search(null, false);
                row = cursor.NextRow();
                while (row != null)
                {
                    DataRow drow = m_AttributeTable.NewRow();
                    for (int k = 0; k < pTableR.Fields.FieldCount; k++)
                    {
                        drow[k] = row.get_Value(k);
                    }

                    IRow    jrow    = null;
                    ICursor jcursor = pTableJ.Search(null, false);
                    jrow = jcursor.NextRow();
                    while (jrow != null)
                    {
                        if (row.get_Value(cmbtable.SelectedIndex).ToString() == jrow.get_Value(cmbjointable.SelectedIndex).ToString())
                        {
                            for (int m = 0; m < pTableJ.Fields.FieldCount; m++)
                            {
                                drow[pTableR.Fields.FieldCount + m] = jrow.get_Value(m);
                            }
                            break;
                        }
                        jrow = jcursor.NextRow();
                    }
                    m_AttributeTable.Rows.Add(drow);
                    row = cursor.NextRow();
                }
            }
            else
            {
                IRow    row    = null;
                ICursor cursor = pTableR.Search(null, false);
                row = cursor.NextRow();
                while (row != null)
                {
                    DataRow drow    = m_AttributeTable.NewRow();
                    IRow    jrow    = null;
                    ICursor jcursor = pTableJ.Search(null, false);
                    jrow = jcursor.NextRow();
                    while (jrow != null)
                    {
                        if (row.get_Value(cmbtable.SelectedIndex).ToString() == jrow.get_Value(cmbjointable.SelectedIndex).ToString())
                        {
                            for (int k = 0; k < pTableR.Fields.FieldCount; k++)
                            {
                                drow[k] = row.get_Value(k);
                            }

                            for (int m = 0; m < pTableJ.Fields.FieldCount; m++)
                            {
                                drow[pTableR.Fields.FieldCount + m] = jrow.get_Value(m);
                            }
                            break;
                        }
                        jrow = jcursor.NextRow();
                    }

                    m_AttributeTable.Rows.Add(drow);
                    row = cursor.NextRow();
                }
            }



            m_gridfield.AutoGenerateColumns = true;
            m_barTable.Show();
            int nItemCount = m_barTable.Items.Count;

            for (int i = 0; i < nItemCount; i++)
            {
                m_barTable.Items[i].Visible = true;
            }
            m_barTable.Invalidate();
            m_barTable.Text         = pLayer.Name;
            m_docktable.Text        = pLayer.Name;
            m_gridfield.DataSource  = m_AttributeTable;
            m_gridfield.CurrentCell = null;

            this.Close();
        }