示例#1
0
 private void btnSelect_Click(object sender, EventArgs e)
 {
     try
     {
         ISymbolArray chartSymbol = this.ichartRenderer_0.ChartSymbol as ISymbolArray;
         string[]     strArray    = new string[2];
         for (int i = this.FieldsListBoxCtrl.SelectedIndices.Count - 1; i >= 0; i--)
         {
             int       index = this.FieldsListBoxCtrl.SelectedIndices[i];
             FieldWrap wrap  = this.FieldsListBoxCtrl.Items[index] as FieldWrap;
             (this.ichartRenderer_0 as IRendererFields).AddField(wrap.Name, wrap.ToString());
             IColor color = this.ienumColors_0.Next();
             if (color == null)
             {
                 this.ienumColors_0.Reset();
                 color = this.ienumColors_0.Next();
             }
             ISymbol symbol = this.method_5(color);
             strArray[0] = "";
             strArray[1] = wrap.ToString();
             ListViewItemEx ex = new ListViewItemEx(strArray)
             {
                 Style = symbol,
                 Tag   = wrap
             };
             this.SelectFieldslistView.Add(ex);
             chartSymbol.AddSymbol(symbol);
             this.FieldsListBoxCtrl.Items.RemoveAt(index);
         }
     }
     catch
     {
     }
     this.btnUnSelectAll.Enabled = true;
 }
示例#2
0
        private void btnMoveDown_Click(object sender, EventArgs e)
        {
            int            index = this.SelectFieldslistView.SelectedIndices[0];
            ListViewItemEx ex    = this.SelectFieldslistView.Items[index] as ListViewItemEx;

            this.SelectFieldslistView.Items.RemoveAt(index);
            if ((index + 1) == this.SelectFieldslistView.Items.Count)
            {
                this.SelectFieldslistView.Items.Add(ex);
            }
            else
            {
                this.SelectFieldslistView.Items.Insert(index + 1, ex);
            }
            ISymbolArray dotDensitySymbol = this.idotDensityRenderer_0.DotDensitySymbol as ISymbolArray;

            dotDensitySymbol.MoveSymbol(dotDensitySymbol.get_Symbol(index), index + 1);
            IRendererFields fields = this.idotDensityRenderer_0 as IRendererFields;

            fields.ClearFields();
            for (int i = 0; i < this.SelectFieldslistView.Items.Count; i++)
            {
                ex = this.SelectFieldslistView.Items[i] as ListViewItemEx;
                FieldWrap tag = ex.Tag as FieldWrap;
                fields.AddField(tag.Name, tag.ToString());
            }
        }
示例#3
0
        public void ResetField()
        {
            string    name         = "";
            FieldWrap selectedItem = null;

            if (this.cboFields.SelectedIndex != -1)
            {
                selectedItem = this.cboFields.SelectedItem as FieldWrap;
                name         = selectedItem.Name;
            }
            this.cboFields.Properties.Items.Clear();
            this.ifields_0 = null;
            if (this.ilayer_0 != null)
            {
                IFields fields;
                if (this.ilayer_0 is IDisplayTable)
                {
                    fields = (this.ilayer_0 as IDisplayTable).DisplayTable.Fields;
                }
                else if (this.ilayer_0 is IGeoFeatureLayer)
                {
                    if ((this.ilayer_0 as IGeoFeatureLayer).FeatureClass == null)
                    {
                        return;
                    }
                    fields = (this.ilayer_0 as IGeoFeatureLayer).FeatureClass.Fields;
                }
                else
                {
                    fields = (this.ilayer_0 as IAttributeTable).AttributeTable.Fields;
                }
                this.ifields_0 = fields;
                FieldWrap wrap2 = null;
                for (int i = 0; i < fields.FieldCount; i++)
                {
                    IField field = fields.get_Field(i);
                    if ((((field.Type != esriFieldType.esriFieldTypeOID) &&
                          (field.Type != esriFieldType.esriFieldTypeGeometry)) &&
                         (field.Type != esriFieldType.esriFieldTypeBlob)) &&
                        (field.Type != esriFieldType.esriFieldTypeRaster))
                    {
                        FieldWrap item = new FieldWrap(field);
                        if (name == field.Name)
                        {
                            wrap2 = item;
                        }
                        this.cboFields.Properties.Items.Add(item);
                    }
                }
                if (wrap2 != null)
                {
                    this.cboFields.SelectedItem = wrap2;
                }
                else if (this.cboFields.Properties.Items.Count > 0)
                {
                    this.cboFields.SelectedIndex = 0;
                }
            }
        }
示例#4
0
        private void btnMoveUp_Click(object sender, EventArgs e)
        {
            int            index = this.SelectFieldslistView.SelectedIndices[0];
            ListViewItemEx item  = this.SelectFieldslistView.Items[index] as ListViewItemEx;

            this.SelectFieldslistView.Items.RemoveAt(index);
            this.SelectFieldslistView.Items.Insert(index - 1, item);
            ISymbolArray chartSymbol = this.ichartRenderer_0.ChartSymbol as ISymbolArray;

            chartSymbol.MoveSymbol(chartSymbol.get_Symbol(index), index - 1);
            IRendererFields fields = this.ichartRenderer_0 as IRendererFields;

            fields.ClearFields();
            for (int i = 0; i < this.SelectFieldslistView.Items.Count; i++)
            {
                item = this.SelectFieldslistView.Items[i] as ListViewItemEx;
                FieldWrap tag = item.Tag as FieldWrap;
                fields.AddField(tag.Name, tag.ToString());
            }
        }
示例#5
0
 private void method_1()
 {
     this.cboFields.Properties.Items.Clear();
     this.listView1.Items.Clear();
     this.btnDelete.Enabled = false;
     this.ifields_0         = null;
     if (this.ilayer_0 != null)
     {
         IFields fields;
         int     num;
         if (this.ilayer_0 is IDisplayTable)
         {
             fields = (this.ilayer_0 as IDisplayTable).DisplayTable.Fields;
         }
         else if (this.ilayer_0 is IGeoFeatureLayer)
         {
             if ((this.ilayer_0 as IGeoFeatureLayer).FeatureClass == null)
             {
                 return;
             }
             fields = (this.ilayer_0 as IGeoFeatureLayer).FeatureClass.Fields;
         }
         else
         {
             fields = (this.ilayer_0 as IAttributeTable).AttributeTable.Fields;
         }
         this.ifields_0 = fields;
         string    str  = this.iuniqueValueRenderer_0.get_Field(0);
         FieldWrap wrap = null;
         for (num = 0; num < fields.FieldCount; num++)
         {
             IField field = fields.get_Field(num);
             if ((((field.Type != esriFieldType.esriFieldTypeOID) &&
                   (field.Type != esriFieldType.esriFieldTypeGeometry)) &&
                  (field.Type != esriFieldType.esriFieldTypeBlob)) &&
                 (field.Type != esriFieldType.esriFieldTypeRaster))
             {
                 FieldWrap item = new FieldWrap(field);
                 if (str == field.Name)
                 {
                     wrap = item;
                 }
                 this.cboFields.Properties.Items.Add(item);
             }
         }
         if (str.Length == 0)
         {
             if (this.cboFields.Properties.Items.Count > 0)
             {
                 this.cboFields.SelectedIndex = 0;
                 this.iuniqueValueRenderer_0.set_Field(0, (this.cboFields.SelectedItem as FieldWrap).Name);
                 esriFieldType type = (this.cboFields.SelectedItem as FieldWrap).Type;
                 this.iuniqueValueRenderer_0.set_FieldType(0, type == esriFieldType.esriFieldTypeString);
             }
         }
         else
         {
             this.cboFields.SelectedItem = wrap;
         }
         if (this.icolorRamp_0 != null)
         {
             bool flag;
             if (this.int_0 > 0)
             {
                 this.icolorRamp_0.Size = this.int_0;
             }
             else
             {
                 this.icolorRamp_0.Size = 2;
             }
             this.icolorRamp_0.CreateRamp(out flag);
             this.ienumColors_0 = this.icolorRamp_0.Colors;
             this.ienumColors_0.Reset();
         }
         object[] objArray = new object[4];
         SortedList <string, ListViewItemEx> list = new SortedList <string, ListViewItemEx>();
         for (num = 0; num < this.iuniqueValueRenderer_0.ValueCount; num++)
         {
             ListViewItemEx ex;
             string         str2 = this.iuniqueValueRenderer_0.get_Value(num);
             string         key  = "";
             try
             {
                 key = this.iuniqueValueRenderer_0.get_ReferenceValue(str2);
                 if (list.ContainsKey(key))
                 {
                     ex = list[key];
                     ListViewItem.ListViewSubItem item1 = ex.SubItems[1];
                     item1.Text = item1.Text + ";" + str2;
                 }
             }
             catch (Exception)
             {
                 objArray[0] = this.iuniqueValueRenderer_0.get_Symbol(str2);
                 objArray[1] = str2;
                 objArray[2] = this.iuniqueValueRenderer_0.get_Label(str2);
                 objArray[3] = "?";
                 ex          = this.listView1.Add(objArray);
                 list.Add(str2, ex);
             }
         }
     }
 }