protected void initPerspectives() { bruteForce = new PerspectiveInfo("Bruteforce", style.colors["black.vs"], style.colors["red.king yna"], style.colors["white.argon"], style.colors["white.argon"], style.colors["red.king yna"], false, false, true, 0.001, -1, -2, 2, 2, 3, 3, 5, 100); piacovsky = new PerspectiveInfo("Piyavsky method", style.colors["black.vs"], style.colors["blue.king yna"], style.colors["white.argon"], style.colors["white.argon"], style.colors["blue.vs"], true, false, true, 0.001, 3, -2, 2, 2, 3, 3, 5, 100); strongin = new PerspectiveInfo("Strongin method", style.colors["black.vs"], style.colors["yellow.king yna"], style.colors["black.argon"], style.colors["white.argon"], style.colors["yellow.king yna"], true, false, true, 0.001, 3, -2, 2, 2, 3, 3, 5, 100); perspective = bruteForce; }
public void refreshGraph(PerspectiveInfo perspective) { var pane = perspective.methodInfo.graphControl.GraphPane; pane.CurveList.Clear(); var w = perspective.methodInfo.graphControl.Width; var h = perspective.methodInfo.graphControl.Height; var elem = perspective.funcInfo; PointPairList ppList = new PointPairList(); var step = (elem.xMax - elem.xMin) / w; for (double i = elem.xMin; i <= elem.xMax; i += step) { var curY = perspective.funcInfo.function(i); if (curY < elem.yMin) { elem.yMin = curY; } if (curY > elem.yMax) { elem.yMax = curY; } ppList.Add(new PointPair(i, curY)); } var curve = pane.AddCurve("", ppList, perspective.colorLine, ZedGraph.SymbolType.None); curve.Line.Width = 4.0f; if (perspective.withPoint) { foreach (var point in perspective.methodInfo.report.iterations) { if (point.x >= elem.xMin && point.x <= elem.xMax) { var line = new PointPairList(); line.Add(new PointPair(point.x, 0)); line.Add(new PointPair(point.x, perspective.funcInfo.function(point.x))); curve = pane.AddCurve("", line, perspective.colorPoint, ZedGraph.SymbolType.None); curve.Line.Width = 0.5f; } } } if (perspective.withLine && perspective.withMainLine) { drawVerticalLine(perspective, true); } perspective.methodInfo.graphControl.AxisChange(); perspective.methodInfo.graphControl.Invalidate(); }
//public void drawVerticalLine(ZedGraphControl zgControl, SortedList<int, double> x, FElem elem) public void drawVerticalLine(PerspectiveInfo perspective, bool isMainLine) { var pane = perspective.methodInfo.graphControl.GraphPane; var line = new PointPairList(); if (isMainLine) { line.Add(new PointPair(perspective.mainLineX, 2 * perspective.funcInfo.yMin - perspective.funcInfo.yMax)); line.Add(new PointPair(perspective.mainLineX, 2 * perspective.funcInfo.yMax - perspective.funcInfo.yMin)); var curve = pane.AddCurve("", line, perspective.colorMainLine, ZedGraph.SymbolType.None); curve.Line.Width = 2f; } else { line.Add(new PointPair(perspective.curLineX, 2 * perspective.funcInfo.yMin - perspective.funcInfo.yMax)); line.Add(new PointPair(perspective.curLineX, 2 * perspective.funcInfo.yMax - perspective.funcInfo.yMin)); var curve = pane.AddCurve("", line, perspective.colorMainLine, ZedGraph.SymbolType.None); curve.Line.Width = 0.5f; } }
private void returnTablePanel(PerspectiveInfo perspective) { tableLayoutPanel = new TableLayoutPanel(); this.tableLayoutPanel.AutoScroll = true; this.tableLayoutPanel.BackColor = perspective.colorPanel; this.tableLayoutPanel.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single; this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.tableLayoutPanel.Location = new System.Drawing.Point(200, 90); this.tableLayoutPanel.Margin = new System.Windows.Forms.Padding(2); this.tableLayoutPanel.Name = "tableLayoutPanel"; this.tableLayoutPanel.RowCount = 1; this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel.Size = new System.Drawing.Size(672, 134); this.tableLayoutPanel.Visible = false; panelTable.Controls.Clear(); panelTable.Controls.Add(tableLayoutPanel); var iterations = new List <Method.Trial>(perspective.methodInfo.report.iterations); if (perspective.sortBy == "i" && perspective.sortDir == "BottomUp") { iterations.Sort(delegate(Method.Trial left, Method.Trial right) { return(left.i.CompareTo(right.i)); }); } if (perspective.sortBy == "x" && perspective.sortDir == "BottomUp") { iterations.Sort(delegate(Method.Trial left, Method.Trial right) { return(left.x.CompareTo(right.x)); }); } if (perspective.sortBy == "y" && perspective.sortDir == "BottomUp") { iterations.Sort(delegate(Method.Trial left, Method.Trial right) { return(left.y.CompareTo(right.y)); }); } if (perspective.sortBy == "i" && perspective.sortDir == "TopDown") { iterations.Sort(delegate(Method.Trial left, Method.Trial right) { return(right.i.CompareTo(left.i)); }); } if (perspective.sortBy == "x" && perspective.sortDir == "TopDown") { iterations.Sort(delegate(Method.Trial left, Method.Trial right) { return(right.x.CompareTo(left.x)); }); } if (perspective.sortBy == "y" && perspective.sortDir == "TopDown") { iterations.Sort(delegate(Method.Trial left, Method.Trial right) { return(right.y.CompareTo(left.y)); }); } int i = 0; foreach (var kv in iterations) { if (i++ >= perspective.sortTop) { break; } tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize)); tableLayoutPanel.Controls.Add(new Label() { Text = string.Format("{0}\n{1}\n{2}", (kv.i - 2).ToString(), kv.x.ToString("0.00000"), kv.y.ToString("0.00000")), TextAlign = System.Drawing.ContentAlignment.MiddleCenter, Dock = DockStyle.Left, Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))), BackColor = perspective.colorPanel, ForeColor = perspective.colorText }, i, 0); } foreach (System.Windows.Forms.Control c in this.tableLayoutPanel.Controls) { c.MouseClick += new System.Windows.Forms.MouseEventHandler(ClickOnTableLayoutPanel); c.MouseEnter += new EventHandler(EnterInTableLayoutPanel); c.MouseLeave += new EventHandler(LeaveOfTableLayoutPanel); } tableLayoutPanel.Visible = true; }
protected void clearCurMethod() { buttonRun.Text = "RUN"; double testD; int testI; if (perspective.name == "Bruteforce") { bruteForce = new PerspectiveInfo("Bruteforce", style.colors["black.vs"], style.colors["red.king yna"], style.colors["white.argon"], style.colors["white.argon"], style.colors["red.king yna"], false, false, true, 0, -1, -2, 2, 2, 3, 3, 5, 100); perspective = bruteForce; } if (perspective.name == "Piyavsky method") { piacovsky = new PerspectiveInfo("Piyavsky method", style.colors["black.vs"], style.colors["blue.king yna"], style.colors["white.argon"], style.colors["white.argon"], style.colors["blue.vs"], true, false, true, 0.001, 3, -2, 2, 2, 3, 3, 5, 100); perspective = piacovsky; if (double.TryParse(textBoxR.Text, out testD)) { perspective.r = double.Parse(textBoxR.Text); } } if (perspective.name == "Strongin method") { strongin = new PerspectiveInfo("Strongin method", style.colors["black.vs"], style.colors["yellow.king yna"], style.colors["black.argon"], style.colors["white.argon"], style.colors["yellow.king yna"], true, false, true, 0.001, 3, -2, 2, 2, 3, 3, 5, 100); perspective = strongin; if (double.TryParse(textBoxR.Text, out testD)) { perspective.r = double.Parse(textBoxR.Text); } } if (double.TryParse(textBoxA.Text, out testD)) { perspective.a = double.Parse(textBoxA.Text); } if (double.TryParse(textBoxB.Text, out testD)) { perspective.b = double.Parse(textBoxB.Text); } if (double.TryParse(textBoxC.Text, out testD)) { perspective.c = double.Parse(textBoxC.Text); } if (double.TryParse(textBoxD.Text, out testD)) { perspective.d = double.Parse(textBoxD.Text); } if (double.TryParse(textBoxE.Text, out testD)) { perspective.e = double.Parse(textBoxE.Text); } if (double.TryParse(textBoxXBegin.Text, out testD)) { perspective.xLeft = double.Parse(textBoxXBegin.Text); } if (double.TryParse(textBoxXEnd.Text, out testD)) { perspective.xRight = double.Parse(textBoxXEnd.Text); } if (double.TryParse(textBoxMaxStepCount.Text, out testD)) { perspective.maxStepCount = int.Parse(textBoxMaxStepCount.Text); } refreshActionPanel(); }