private double DrawLevel(Diagrams.NeuronLevel level, double startTop, double startLeft) { // top (1st number) goes deeper // left (2nd number) goes to side // start:0 > width:20 > space:5 > width:20 if (level == null) { return(startTop); } this.DrawNode(Multiplication, startTop, startLeft); startLeft += Size + Space; double childrenTop = startTop; double mainTop = startTop; if (level.Excludes.Any()) { this.DrawNode(Inversion, childrenTop, startLeft); this.DrawNode(Addition, childrenTop, startLeft + Size + Space); foreach (var l in level.Excludes) { childrenTop = this.DrawLevel(l, childrenTop, startLeft + 2 * (Size + Space)); } mainTop += Size + Space; } Diagrams.Point point = null; while ((point = level.Include.NextVertex(point)) != null) { this.DrawNode(Border, mainTop, startLeft); mainTop += Size + Space; } var maxTop = childrenTop > mainTop ? childrenTop : mainTop; this.Surface.Height = this.Surface.Height > maxTop ? this.Surface.Height : maxTop; return(maxTop); }
public NeuralNetworkTreeWindow(Diagrams.NeuronLevel level) { InitializeComponent(); this.DrawLevel(level, 0, 0); }