internal NeuronLayerDrawing(NeuronLayer layer, IDictionary <NodeBase, INodeDrawing> previousNodes, ICanvas edgesCanvas, IPreference preferences, LayerSizesPreCalc cache, NeuronSizesPreCalc neuronCache, SimpleNodeSizesPreCalc biasCache, EdgeSizesPreCalc edgesCache, IElementSelectionChecker selectionChecker, ISelectableElementRegister selectableElementRegister) : base(layer, preferences, cache, biasCache, selectionChecker, selectableElementRegister) { _previousNodes = previousNodes; _edgesCanvas = edgesCanvas; _preferences = preferences; _neuronCache = neuronCache; _edgesCache = edgesCache; _selectionChecker = selectionChecker; _selectableElementRegister = selectableElementRegister; }
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 EdgeDrawing(Edge element, IEdgePreference preferences, Position fromPosition, Position toPosition, int textHeight, EdgeSizesPreCalc cache, ISelectableElementRegister selectableElementRegister, IElementSelectionChecker selectionChecker) : base(element) { _preferences = preferences; _fromPosition = fromPosition; _toPosition = toPosition; _textHeight = textHeight; _cache = cache; _selectableElementRegister = selectableElementRegister; _selectionChecker = selectionChecker; }
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; } }