/// <summary>
 /// creates a new instance of the PointScheme, but assigns the specified symbolizer
 /// as the symbolizer to use on a single default category.
 /// </summary>
 /// <param name="extent">The geographic point size for the default will be 1/100th the specified extent</param>
 public PointScheme(IEnvelope extent)
 {
     Configure();
     PointCategory def = new PointCategory(extent);
     Categories.Add(def);
 }
 /// <summary>
 /// Creates a new instance of PointScheme with no categories added to the list yet.
 /// </summary>
 public PointScheme()
 {
     Configure();
     PointCategory def = new PointCategory();
     Categories.Add(def);
 }
        /// <summary>
        /// Calculates the unique colors as a scheme 
        /// </summary>
        /// <param name="fs">The featureset with the data Table definition</param>
        /// <param name="uniqueField">The unique field</param>
        public Hashtable GenerateUniqueColors(IFeatureSet fs, string uniqueField)
        {
            Hashtable result = new Hashtable(); // a hashtable of colors
            DataTable dt = fs.DataTable;
            ArrayList vals = new ArrayList();
            int i = 0;
            foreach (DataRow row in dt.Rows)
            {
                if (uniqueField != "FID")
                {

                    if (vals.Contains(row[uniqueField]) == false)
                    {
                        vals.Add(row[uniqueField]);
                    }
                }
                else
                {
                    vals.Add(i);
                    i++;
                }
            }
            Random rnd = new Random();
            foreach (object item in vals)
            {
                Color c = rnd.NextColor();
                while (result.ContainsKey(c))
                {
                    c = rnd.NextColor();
                }
                PointCategory cat = new PointCategory(c, PointShapes.Rectangle, 10);
                string flt = "[" + uniqueField + "] = ";
                if (uniqueField == "FID")
                {
                    flt += item;
                }
                else
                {
                    if (dt.Columns[uniqueField].DataType == typeof(string))
                    {
                        flt += "'" + item + "'";
                    }
                    else
                    {
                        flt += item.ToString();
                    }
                }
                cat.FilterExpression = flt;
                Categories.Add(cat);
                result.Add(c, item);
            }
            return result;
        }
 /// <summary>
 /// Uses the settings on this scheme to create a random category.
 /// </summary>
 /// <returns>A new IFeatureCategory</returns>
 public override IFeatureCategory CreateRandomCategory(string filterExpression)
 {
     PointCategory result = new PointCategory();
     Color fillColor = CreateRandomColor();
     result.Symbolizer = new PointSymbolizer(fillColor, PointShapes.Ellipse, 10);
     result.FilterExpression = filterExpression;
     result.LegendText = filterExpression;
     return result;
 }
 private PointScheme ColorBox(List<Color> colors)
 {
     PointScheme ps = new PointScheme();
     ps.Categories.Clear();
     foreach (Color color in colors)
     {
         IColorable c = _template as IColorable;
         if(c != null)
         {
             c.Color = color;
         }
         PointCategory pc = new PointCategory(_template);
         ps.Categories.Add(pc);
     }
     ps.Categories[0].FilterExpression = "[" + _classificationField + "] < ";
     return ps;
 }