SharpNeat.View.Graph.IOGraphPainter.PaintNode C# (CSharp) Метод

PaintNode() защищенный Метод

Paints a single graph node.
protected PaintNode ( GraphNode node, PaintState state ) : void
node GraphNode
state PaintState
Результат void
        protected virtual void PaintNode(GraphNode node, PaintState state)
        {
            Point nodePos = ModelToViewport(node.Position, state);
            if(!IsPointWithinViewport(nodePos, state))
            {   // Skip node. It's outside the viewport area.
                return;
            }

            // Paint the node as a square. Create a Rectangle that represents the square's position and size.
            Point p = new Point(nodePos.X - state._nodeDiameterHalf, nodePos.Y - state._nodeDiameterHalf);
            Size s = new Size(state._nodeDiameter, state._nodeDiameter);
            Rectangle r = new Rectangle(p, s);

            // Paint the node. Fill first and then border, this gives a clean border.
            Graphics g = state._g;
            g.FillRectangle(__brushNodeFill, r);
            g.DrawRectangle(__penBlack, r);

            // Draw the node tag.
            nodePos.X += state._nodeDiameterHalf+1;
            nodePos.Y -= state._nodeDiameterHalf/2;
            g.DrawString(node.Tag, __fontNodeTag, __brushBlack, nodePos);
        }