コード例 #1
0
        protected override void OnSelChange(int cookie)
        {
            if (cookie < 0)
            {
                return;
            }
            s_selectedLayer = this.GetItem(cookie).Caption;
            CboFields.ClearAllItems();
            IMap map = (ArcMap.Document as IMxDocument).FocusMap;

            for (int i = 0; i < map.LayerCount; i++)
            {
                ILayer layer = map.Layer[i];
                if (layer.Name == s_selectedLayer) // && layer is IFeatureLayer
                {
                    IFeatureClass fClass = (layer as IFeatureLayer).FeatureClass;
                    for (int j = 0; j < fClass.Fields.FieldCount; j++)
                    {
                        switch (fClass.Fields.Field[j].Type)
                        {
                        case esriFieldType.esriFieldTypeDouble:
                        case esriFieldType.esriFieldTypeInteger:
                        case esriFieldType.esriFieldTypeSingle:
                        case esriFieldType.esriFieldTypeSmallInteger:
                            CboFields.AddItem(fClass.Fields.Field[j].Name);
                            break;
                        }
                    }
                    break;
                }
            }
            CboRenderers.UpdateRenderers();
        }
コード例 #2
0
 protected override void OnSelChange(int cookie)
 {
     if (cookie < 0)
     {
         return;
     }
     s_selectedField = this.GetItem(cookie).Caption;
     CboRenderers.Render();
 }
コード例 #3
0
 protected override void OnSelChange(int cookie)
 {
     if (cookie < 0)
     {
         return;
     }
     s_selectedColor = this.GetItem(cookie).Caption;
     ColorbrewerExtension.UpdateCboClasses();
     CboRenderers.Render();
 }
コード例 #4
0
        internal static void UpdateCboClasses()
        {
            try
            {
                CboClasses.ClearAllItems();
                string selectedColor = CboColors.GetSelectedColor();
                /* FILEPATH needs to be modified whenever the cb.csv file is moved aka during installation */
                System.IO.StreamReader file =
                    new System.IO.StreamReader(filepath);
                string line;
                string currentColor = "";

                List <string> values = new List <string>();
                while ((line = file.ReadLine()) != null)
                {
                    string[] words = line.Split(',');
                    string   value = "";
                    if (words[0] != "")
                    {
                        currentColor = words[0];
                    }
                    if (currentColor.Equals(selectedColor))
                    {
                        switch (CboRenderers.GetSelectedRenderer())
                        {
                        case "Simple Marker Renderer":
                        case "Simple Fill Renderer":
                        case "Proportional Symbol Renderer":
                            value = words[5];
                            break;

                        case "Classbreaks Renderer":
                            value = words[1];
                            break;
                        }
                        if (!values.Contains(value) && !value.Equals(""))
                        {
                            values.Add(value);
                        }
                    }
                }
                foreach (string value in values)
                {
                    CboClasses.AddItem(value);
                }
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.ToString());
                LocateCBfile();
                UpdateCboClasses();
            }
        }
コード例 #5
0
 public CboRenderers()
 {
     s_CboRenderers = this;
 }
コード例 #6
0
 protected override void OnUpdate()
 {
     Enabled = CboRenderers.GetSelectedRenderer() != null;
 }