internal PerceptronDrawing(Perceptron element, IDictionary <NodeBase, INodeDrawing> previousNodes, ICanvas edgesCanvas, Preference preferences, PerceptronSizesPreCalc cache, EdgeSizesPreCalc edgesCache, IElementSelectionChecker selectionChecker, ISelectableElementRegister selectableElementRegister) : base(element, preferences.Perceptrons, cache, selectableElementRegister, selectionChecker) { _previousNodes = previousNodes; _edgesCanvas = edgesCanvas; _preferences = preferences; _cache = cache; _edgesCache = edgesCache; _selectionChecker = selectionChecker; _selectableElementRegister = selectableElementRegister; }
internal PerceptronLayerDrawing(PerceptronLayer layer, IDictionary <NodeBase, INodeDrawing> previousNodes, ICanvas edgesCanvas, Preference preferences, LayerSizesPreCalc cache, PerceptronSizesPreCalc perceptronCache, SimpleNodeSizesPreCalc biasCache, EdgeSizesPreCalc edgesCache, IElementSelectionChecker selectionChecker, ISelectableElementRegister selectableElementRegister) : base(layer, preferences, cache, biasCache, selectionChecker, selectableElementRegister) { _previousNodes = previousNodes; _edgesCanvas = edgesCanvas; _preferences = preferences; _perceptronCache = perceptronCache; _edgesCache = edgesCache; this._selectionChecker = selectionChecker; this._selectableElementRegister = selectableElementRegister; }
private async Task DrawLayersGeneral(Graphics graph, Func <ILayerDrawing, ICanvas, Task> drawLayerAction) { var layersDrawingSize = this.ControlCanvas.GetLayersDrawingSize(); var graphCanvas = new GraphicsCanvas(graph, this.ControlCanvas.Size.Width, this.ControlCanvas.Size.Height); int x = 0; _selectionResolver.SetCurrentRootCanvas(graphCanvas); IDictionary <NodeBase, INodeDrawing> previousNodesDic = new Dictionary <NodeBase, INodeDrawing>(); var inputLayer = this.ControlCanvas.Control.InputLayer; var preferences = this.ControlCanvas.Control.Preferences; LayerSizesPreCalc layersCache = new LayerSizesPreCalc(layersDrawingSize, inputLayer.GetMaxNodeCountInLayer(), preferences); SimpleNodeSizesPreCalc simpleNodesCache = new SimpleNodeSizesPreCalc(); PerceptronSizesPreCalc perceptronCache = new PerceptronSizesPreCalc(preferences); EdgeSizesPreCalc edgesCache = new EdgeSizesPreCalc(); for (LayerBase layer = inputLayer; layer != null; layer = layer.Next) { ILayerDrawing layerDrawing = null; if (layer == inputLayer) { layerDrawing = new InputLayerDrawing(layer as InputLayer, preferences, layersCache, simpleNodesCache, _selectionChecker, _selectableElementRegister); } else { layerDrawing = new PerceptronLayerDrawing(layer as PerceptronLayer, previousNodesDic, graphCanvas, preferences, layersCache, perceptronCache, simpleNodesCache, edgesCache, _selectionChecker, _selectableElementRegister); } var canvasRect = new Rectangle(x, 0, layersDrawingSize.Width, layersDrawingSize.Height); var layerCanvas = new NestedCanvas(canvasRect, graphCanvas); await drawLayerAction(layerDrawing, layerCanvas); previousNodesDic = layerDrawing.NodesDrawing.ToDictionary(n => n.Node, n => n); x += layersDrawingSize.Width; } }