private void btnAddRule_Click(object sender, EventArgs e)
        {
            frmRule rule = new frmRule
            {
                OriginClassArray = TopologyEditHelper.m_pList
            };

            if (rule.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    if (!rule.bVaildRule)
                    {
                        MessageBox.Show("无效规则!");
                    }
                    else
                    {
                        ITopologyRule topologyRule = rule.TopologyRule;
                        if (!this.method_2(topologyRule))
                        {
                            string[] items = new string[3];
                            items[0] =
                                (this.itopology_0 as IFeatureClassContainer).get_ClassByID(topologyRule.OriginClassID)
                                .AliasName;
                            items[1] = this.method_0(topologyRule.TopologyRuleType);
                            if ((topologyRule.OriginClassID != topologyRule.DestinationClassID) &&
                                (topologyRule.DestinationClassID > 0))
                            {
                                items[2] =
                                    (this.itopology_0 as IFeatureClassContainer).get_ClassByID(
                                        topologyRule.DestinationClassID).AliasName;
                            }
                            ListViewItem item = new ListViewItem(items)
                            {
                                Tag = new Class2(topologyRule, true)
                            };
                            this.listView1.Items.Add(item);
                            this.bool_0 = true;
                            if (this.OnValueChange != null)
                            {
                                this.OnValueChange();
                            }
                        }
                        else
                        {
                            MessageBox.Show("该规则已应用到该要素类!");
                        }
                    }
                }
                catch (Exception exception)
                {
                    Logger.Current.Error("", exception, "");
                }
            }
        }
Beispiel #2
0
        private void btnAddRule_Click(object sender, EventArgs e)
        {
            frmRule rule = new frmRule
            {
                OriginClassArray = this.iarray_1
            };

            if (rule.ShowDialog() == DialogResult.OK)
            {
                if (!rule.bVaildRule)
                {
                    MessageBox.Show("无效规则!");
                }
                else
                {
                    ITopologyRule topologyRule = rule.TopologyRule;
                    if (this.method_2(topologyRule))
                    {
                        MessageBox.Show("该规则已应用到该要素类!");
                    }
                    else
                    {
                        int           num;
                        IFeatureClass class2;
                        for (num = 0; num < this.iarray_0.Count; num++)
                        {
                            class2 = (IFeatureClass)this.iarray_0.get_Element(num);
                            if (class2.ObjectClassID == topologyRule.OriginClassID)
                            {
                                this.listRule.Items.Add(class2.AliasName);
                                this.listRule.Items[this.listRule.Items.Count - 1].SubItems.Add(topologyRule.Name);
                                this.listRule.Items[this.listRule.Items.Count - 1].Tag = topologyRule;
                                break;
                            }
                        }
                        if (topologyRule.OriginClassID != topologyRule.DestinationClassID)
                        {
                            for (num = 0; num < this.iarray_0.Count; num++)
                            {
                                class2 = (IFeatureClass)this.iarray_0.get_Element(num);
                                if (class2.ObjectClassID == topologyRule.DestinationClassID)
                                {
                                    this.listRule.Items[this.listRule.Items.Count - 1].SubItems.Add(class2.AliasName);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }