/// <summary>
 /// Creates a new Custom Point symbolizer with the specified properties
 /// </summary>
 /// <param name="uniqueName">the unique name</param>
 /// <param name="name">the name of the custom symbolizer</param>
 /// <param name="category">the map category of the custom symbolizer</param>
 /// <param name="symbolizer">the associated Point symbolizer</param>
 public CustomPointSymbolizer(string uniqueName, string name, string category, PointSymbolizer symbolizer)
 {
     base.UniqueName = uniqueName;
     base.Name = name;
     base.Category = category;
     base.Symbolizer = symbolizer;
 }
 /// <summary>
 /// Draws a preview of a point symbolizer inside of the specified rectangle
 /// </summary>       
 private void DrawPointSymbolizer(PointSymbolizer sym, Graphics g, Rectangle rect)
 {
     if (sym != null)
     {
         g.Clear(Color.White);
         Matrix shift = g.Transform;
         shift.Translate(rect.Width / 2, rect.Height / 2);
         g.Transform = shift;
         double scale = 1;
         if (sym.ScaleMode == ScaleModes.Geographic || sym.GetSize().Height > (rect.Height - 6))
         {
             scale = (rect.Height - 6) / sym.GetSize().Height;
         }
         sym.Draw(g, scale);
     }
 }
        private static List<CustomSymbolizer> getBasicPointSymbols()
        {
            List<CustomSymbolizer> lst = new List<CustomSymbolizer>();

            PointSymbolizer s1 = new PointSymbolizer();
            const char ch = '\u21e6';
            s1.Symbols.Add(new CharacterSymbol(ch, "arial", Color.Blue,10.0));
            lst.Add(new CustomSymbolizer(s1, "symbol01", "arrow1", "arrows"));

            PointSymbolizer s2 = new PointSymbolizer(Color.Beige, PointShapes.Ellipse, 7.0);
            lst.Add(new CustomSymbolizer(s2, "symbol02", "circle1", "default"));

            return lst;
        }
        /// <summary>
        /// Sets up the Table to work with the specified layer
        /// </summary>
        /// <param name="layer"></param>
        public void Initialize(IFeatureLayer layer)
        {
            _original = layer.Symbology;
            ILegendItem parent = _original.GetParentItem();
            //_original.SetParentItem(null);
            _newScheme = _original.Copy();
            _source = layer.DataSet;
            // _original.SetParentItem(parent); // Disconnect this from actually affecting the layers.
            if(!layer.DataSet.AttributesPopulated)
            {
                if(layer.DataSet.NumRows() < 100000)
                {
                    _source.FillAttributes(); // for small datasets, it is better to just load and cache it.
                }
            }
           
            if(_source.AttributesPopulated)
            {
                _expressionDialog.Table = _source.DataTable;
            }
            else
            {
                _expressionDialog.AttributeSource = _source;
            }
            
            _schemeType = GetSchemeType(layer);

            if (_schemeType != SymbolizerTypes.Polygon)
            {
                chkUseGradients.Visible = false;
                angGradientAngle.Visible = false;
            }
            else
            {
                chkUseGradients.Visible = true;
                angGradientAngle.Visible = true;
            }
            if (_schemeType == SymbolizerTypes.Point)
            {
                IPointScheme ps = _newScheme as IPointScheme;

                if (ps != null)
                {
                    IPointSymbolizer sym;
                    if (ps.Categories.Count == 0 || ps.Categories[0].Symbolizer == null)
                    {
                        sym = new PointSymbolizer();
                    }
                    else
                    {
                        sym = ps.Categories[0].Symbolizer;
                    }
                    _ignoreRefresh = true;
                    featureSizeRangeControl1.SizeRange = new FeatureSizeRange(sym,_newScheme.EditorSettings.StartSize , _newScheme.EditorSettings.EndSize);
                    featureSizeRangeControl1.Initialize(new SizeRangeEventArgs(_newScheme.EditorSettings.StartSize, _newScheme.EditorSettings.EndSize, sym, _newScheme.EditorSettings.UseSizeRange));
                    featureSizeRangeControl1.Scheme = ps;
                    featureSizeRangeControl1.Visible = true;
                    _ignoreRefresh = false;
                }
            }
            else if (_schemeType == SymbolizerTypes.Line)
            {
                ILineScheme ls = _newScheme as ILineScheme;
                if(ls != null)
                {
                    ILineSymbolizer sym;
                    if(ls.Categories.Count == 0 || ls.Categories[0].Symbolizer == null)
                    {
                        sym = new LineSymbolizer();
                    }
                    else
                    {
                        sym = ls.Categories[0].Symbolizer;
                    }
                    _ignoreRefresh = true;
                    featureSizeRangeControl1.SizeRange = new FeatureSizeRange(sym, _newScheme.EditorSettings.StartSize, _newScheme.EditorSettings.EndSize);
                    featureSizeRangeControl1.Initialize(new SizeRangeEventArgs(_newScheme.EditorSettings.StartSize, _newScheme.EditorSettings.EndSize, sym, _newScheme.EditorSettings.UseSizeRange));
                    featureSizeRangeControl1.Scheme = ls;
                    featureSizeRangeControl1.Visible = true;
                    _ignoreRefresh = false;
                }
            }
            else
            {
                featureSizeRangeControl1.Visible = false;
            }
            

            UpdateFields();
            if (_newScheme.EditorSettings.ClassificationType != ClassificationTypes.Quantities) return;
            nudCategoryCount.Enabled = true;
            tabScheme.Visible = true;
            dgvCategories.Height = 217;
            UpdateStatistics(false, null);
        }
 /// <summary>
 /// Creates a new Point Category based on the specified character
 /// </summary>
 /// <param name="character">The character to use for the symbol</param>
 /// <param name="fontFamilyName">The font family name to use as the font</param>
 /// <param name="color">The color of the character</param>
 /// <param name="size">The size of the symbol</param>
 public PointCategory(char character, string fontFamilyName, Color color, double size)
 {
     Symbolizer = new PointSymbolizer(character, fontFamilyName, color, size);
     SelectionSymbolizer = new PointSymbolizer(character, fontFamilyName, Color.Cyan, size);
 }
 /// <summary>
 /// Creates a simple point category where the symbolizer is based on the simple characteristics.
 /// The selection symbolizer has the same shape and size, but will be colored cyan.
 /// </summary>
 /// <param name="color">The color of the regular symbolizer</param>
 /// <param name="shape">The shape of the regular symbolizer</param>
 /// <param name="size">the size of the regular symbolizer</param>
 public PointCategory(Color color, PointShapes shape, double size)
 {
     Symbolizer = new PointSymbolizer(color, shape, size);
     SelectionSymbolizer = new PointSymbolizer(Color.Cyan, shape, size);
 }
 /// <summary>
 /// Creates a new instanec of a default point scheme category where the geographic symbol size has been
 /// scaled to the specified extent.
 /// </summary>
 /// <param name="extent">The geographic extent that is 100 times wider than the geographic size of the points.</param>
 public PointCategory(IEnvelope extent)
 {
     Symbolizer = new PointSymbolizer(false, extent);
     SelectionSymbolizer = new PointSymbolizer(true, extent);
 }
 /// <summary>
 /// Creates a new instance of PointSchemeCategory
 /// </summary>
 public PointCategory()
 {
     Symbolizer = new PointSymbolizer();
     SelectionSymbolizer = new PointSymbolizer(true);
 }
 /// <summary>
 /// Creates a new Point Category from the list of symbols
 /// </summary>
 /// <param name="symbols"></param>
 public PointCategory(IEnumerable<ISymbol> symbols)
 {
     Symbolizer = new PointSymbolizer(symbols);
     List<ISymbol> copy = symbols.CloneList();
  
     if(copy.Count() > 0)
     {
         IColorable c = symbols.Last() as IColorable;
         if(c != null)
         {
             c.Color = Color.Cyan;
         }
     }
     SelectionSymbolizer = new PointSymbolizer(copy);
 }
Esempio n. 10
0
 /// <summary>
 /// Creates a category from the single symbol specified.  If the symbol is colorable,
 /// the color of the selection symbol will be duplicated, but set to cyan.
 /// </summary>
 /// <param name="symbol"></param>
 public PointCategory(ISymbol symbol)
 {
     Symbolizer = new PointSymbolizer(symbol);
     ISymbol copy = symbol.Copy();
     IColorable c = copy as IColorable;
     if(c != null)
     {
         c.Color = Color.Cyan;
     }
     SelectionSymbolizer = new PointSymbolizer(copy);
 }
Esempio n. 11
0
 /// <summary>
 /// Creates a category where the picture is used for the symbol, and a selected
 /// symbol is created as the same symbol but with a cyan border.
 /// </summary>
 /// <param name="picture">The image to use</param>
 /// <param name="size">The size of the symbol</param>
 public PointCategory(Image picture, double size)
 {
     Symbolizer = new PointSymbolizer(picture, size);
     PictureSymbol ps = new PictureSymbol(picture, size);
     ps.OutlineColor = Color.Cyan;
     ps.OutlineWidth = 2;
     ps.OutlineOpacity = 1f;
     SelectionSymbolizer = new PointSymbolizer();
 }
 /// <summary>
 /// Creates a new CustomSymbolizer for symbolizing Points
 /// </summary>
 public CustomPointSymbolizer()
 {
     Symbolizer = new PointSymbolizer();
 }