SharpNeat.View.Graph.IOGraphPainter.PaintNetwork C# (CSharp) Method

PaintNetwork() protected method

Paints the provided IOGraph onto the current GDI+ Graphics drawing surface.
protected PaintNetwork ( IOGraph graph, PaintState state ) : void
graph IOGraph
state PaintState
return void
        protected virtual void PaintNetwork(IOGraph graph, PaintState state)
        {
            // Create per-node state info.
            int hiddenNodeCount = graph.HiddenNodeList.Count;
            int inputNodeCount = graph.InputNodeList.Count;
            int outputNodeCount = graph.OutputNodeList.Count;
            state._nodeStateDict = new Dictionary<GraphNode,ConnectionPointInfo>(hiddenNodeCount + inputNodeCount + outputNodeCount);

            // Paint all connections. We do this first and paint nodes on top of the connections. This allows the 
            // slightly messy ends of the connections to be painted over by the nodes.
            PaintConnections(graph.InputNodeList, state);
            PaintConnections(graph.HiddenNodeList, state);
            PaintConnections(graph.OutputNodeList, state);

            // Paint all nodes. Painted over the top of connection endpoints.
            PaintNodes(graph.InputNodeList, state);
            PaintNodes(graph.HiddenNodeList, state);
            PaintNodes(graph.OutputNodeList, state);
        }

Same methods

IOGraphPainter::PaintNetwork ( IOGraph graph, Graphics g, Rectangle viewportArea, float zoomFactor ) : void

Usage Example

 /// <summary>
 /// Paints the wrapped IOGraph onto the specified viewport. Does nothing if no
 /// IOGraph has been provided.
 /// </summary>
 public void Paint(Graphics g, Rectangle viewportArea, float zoomFactor)
 {
     if (null != _graph)
     {
         _layoutManager.Layout(_graph, viewportArea.Size);
         _graphPainter.PaintNetwork(_graph, g, viewportArea, zoomFactor);
     }
 }