Example #1
0
        /// <summary>
        /// Draws a symbolizer inside the specified rectangle including margins.
        /// </summary>
        /// <param name="g">The graphics device to draw to.</param>
        /// <param name="rect">The Rectangle describing where to draw.</param>
        /// <param name="sym">The IFeatureSymbolizer to draw.</param>
        private void DrawSymbolizer(Graphics g, Rectangle rect, ICustomSymbolizer sym)
        {
            int textHeight      = GetStringHeight(g, sym.Name);
            int innerCellWidth  = _cellSize.Width - (2 * CellMargin);
            int innerCellHeight = _cellSize.Height - (2 * CellMargin) - textHeight;

            Rectangle newRect = new(rect.Left + CellMargin, rect.Top + CellMargin, innerCellWidth, innerCellHeight);

            sym.Symbolizer.Draw(g, newRect);

            if (ShowSymbolNames)
            {
                StringFormat fmt          = new();
                PointF       textLocation = new Point(rect.Left, rect.Bottom - textHeight);
                g.DrawString(sym.Name, TextFont, Brushes.Black, textLocation, fmt);
            }
        }
        /// <summary>
        /// Draws a symbolizer inside the specified rectangle including margins
        /// </summary>
        /// <param name="g">The graphics device to draw to</param>
        /// <param name="rect">The Rectangle describing where to draw</param>
        /// <param name="sym">The IFeatureSymbolizer to draw</param>
        private void DrawSymbolizer(Graphics g, Rectangle rect, ICustomSymbolizer sym)
        {
            int textHeight      = GetStringHeight(g, sym.Name);
            int innerCellWidth  = _cellSize.Width - 2 * _cellMargin;
            int innerCellHeight = _cellSize.Height - 2 * _cellMargin - textHeight;

            Rectangle newRect = new Rectangle(rect.Left + CellMargin, rect.Top + CellMargin, innerCellWidth, innerCellHeight);

            sym.Symbolizer.Draw(g, newRect);

            if (_showSymbolNames)
            {
                StringFormat fmt = new StringFormat();
                //fmt.Alignment = StringAlignment.Center;
                //fmt.LineAlignment = StringAlignment.Center;

                PointF textLocation = new Point(rect.Left, rect.Bottom - textHeight);
                g.DrawString(sym.Name, _textFont, Brushes.Black, textLocation, fmt);
            }
        }
        /// <summary>
        /// Draws a symbolizer inside the specified rectangle including margins
        /// </summary>
        /// <param name="g">The graphics device to draw to</param>
        /// <param name="rect">The Rectangle describing where to draw</param>
        /// <param name="sym">The IFeatureSymbolizer to draw</param>
        private void DrawSymbolizer(Graphics g, Rectangle rect, ICustomSymbolizer sym)
        {
            int textHeight = GetStringHeight(g, sym.Name);
            int innerCellWidth = _cellSize.Width - 2 * _cellMargin;
            int innerCellHeight = _cellSize.Height - 2 * _cellMargin - textHeight;

            Rectangle newRect = new Rectangle(rect.Left + CellMargin, rect.Top + CellMargin, innerCellWidth, innerCellHeight);
            sym.Symbolizer.Draw(g, newRect);

            if (_showSymbolNames)
            {
                StringFormat fmt = new StringFormat();
                //fmt.Alignment = StringAlignment.Center;
                //fmt.LineAlignment = StringAlignment.Center;

                PointF textLocation = new Point(rect.Left, rect.Bottom - textHeight);
                g.DrawString(sym.Name, _textFont, Brushes.Black, textLocation, fmt);
            }
        }