コード例 #1
0
ファイル: BorePlot.cs プロジェクト: JesusFreke/didjimp
            private void mnuViewNodes_Click(object sender, EventArgs e)
            {
                List<decimal> nodes = new List<decimal>();
                List<decimal> antiNodes = new List<decimal>();

                antiNodes.Add(0);
                nodes.Add(((BorePlot)plotSurface2D_).Bore.Length);

                SortedList<decimal, Complex> pressureData = ((BorePlot)plotSurface2D_).pressureData;

                for (int i = 1; i < pressureData.Count - 1; i++)
                {
                    if (Math.Abs(pressureData.Values[i].Real) > Math.Abs(pressureData.Values[i - 1].Real) && Math.Abs(pressureData.Values[i].Real) > Math.Abs(pressureData.Values[i + 1].Real))
                    {
                        antiNodes.Add(pressureData.Keys[i]);
                    }
                    else if (pressureData.Values[i - 1].Real * pressureData.Values[i].Real < 0)
                    {
                        if (Math.Abs(pressureData.Values[i - 1].Real) < Math.Abs(pressureData.Values[i].Real))
                            nodes.Add(pressureData.Keys[i - 1]);
                        else
                            nodes.Add(pressureData.Keys[i]);
                    }
                }

                nodes.Sort();
                antiNodes.Sort();

                StringBuilder sb = new StringBuilder();

                sb.AppendLine("[Pressure Node Locations]");
                foreach (double node in nodes)
                    sb.AppendLine(node.ToString());

                sb.AppendLine("");
                sb.AppendLine("[Pressure Anti-Node Locations]");
                foreach (double antiNode in antiNodes)
                    sb.AppendLine(antiNode.ToString());

                ViewDataDialog viewDataDialog = new ViewDataDialog("Pressure Nodes and Anti-Nodes", sb.ToString());
                viewDataDialog.ShowDialog(plotSurface2D_);
            }
コード例 #2
0
ファイル: BorePlot.cs プロジェクト: JesusFreke/didjimp
            private void mnuViewData_Click(object sender, EventArgs e)
            {
                StringBuilder sb = new StringBuilder();

                for (int i = 0; i < plotSurface2D_.Drawables.Count; ++i)
                {
                    IPlot plot = plotSurface2D_.Drawables[i] as IPlot;
                    if (plot != null)
                    {
                        plot.WriteData(sb);
                    }
                }

                ViewDataDialog viewDataDialog = new ViewDataDialog("Plot Data", sb.ToString());
                viewDataDialog.ShowDialog(plotSurface2D_);
            }