PurplePen.MapRenderer.DrawSymbol C# (CSharp) Method

DrawSymbol() public method

public DrawSymbol ( Symbol symbol, RectangleF rect ) : void
symbol Symbol
rect System.Drawing.RectangleF
return void
        public void DrawSymbol(Symbol symbol, RectangleF rect)
        {
            PointSymDef symdef;

            Pair<object, Symbol> key = new Pair<object, Symbol>(this, symbol);

            // The dictionary is used to contains symdefs for each symbol.
            if (dict.ContainsKey(key)) {
                symdef = (PointSymDef) dict[key];
            }
            else {
                symdef = symbol.CreateSymdef(map, color, Geometry.TransformDistance(rect.Height, currentTransform));
                dict[key] = symdef;
            }

            PointSymbol sym = new PointSymbol(symdef, Geometry.TransformPoint(new PointF(rect.X + rect.Width / 2, rect.Y + rect.Height / 2), currentTransform), 0, null);
            map.AddSymbol(sym);
        }