private void button2_Click(object sender, EventArgs e) { met2.Clear(); met2.Tag = ""; var settings2 = GetSettings(new TurnirSelector(), new RandomScreeener()); var calc2 = new SimpleCalculator(settings2); var d1 = DateTime.Now; var curve2V = calc2.Start(); time2 = DateTime.Now.Subtract(d1); label13.Text = Math.Round(time2.TotalSeconds, 3).ToString(CultureInfo.InvariantCulture); met2 = zedGraphControl1.GraphPane.AddCurve("Метод2", new double[] { 0 }, new double[] { 0 }, Color.Blue); foreach (var d in curve2V) { met2.AddPoint(d.Key, d.Value); } zedGraphControl1.AxisChange(); zedGraphControl1.RestoreScale(zedGraphControl1.GraphPane); }
private void button1_Click(object sender, EventArgs e) { met1.Clear(); met1.Tag = ""; var settings1 = GetSettings(new RuletteSelector(), new SelectionScreener()); var calc1 = new SimpleCalculator(settings1); var d1 = DateTime.Now; var curve1V=calc1.Start(); time1 = DateTime.Now.Subtract(d1); label12.Text = Math.Round(time1.TotalSeconds, 3).ToString(CultureInfo.InvariantCulture); met1 = zedGraphControl1.GraphPane.AddCurve("Метод1", new double[] { 0 }, new double[] { 0 }, Color.Red); foreach (var d in curve1V) { met1.AddPoint(d.Key, d.Value); } zedGraphControl1.AxisChange(); zedGraphControl1.RestoreScale(zedGraphControl1.GraphPane); }
private void AddPoint(LineItem line, double val) { line.AddPoint(index, val); if (line.NPts == 1000) line.RemovePoint(0); }
public Interval(double R, double minH, double maxH, double lambda, ZedGraph.GraphPane graphPane, string stationType, string subRange, int waveNumber) { this.R = R; this.minH = minH; this.maxH = maxH; this.lambda = lambda; this.antennaH = antennaH; this.graphPane = graphPane; this.stationType = stationType; this.subRange = subRange; this.waveNumber = waveNumber; bariers = new List<Barier>(); PointPair begin = new PointPair(0, (minH + maxH) / 2.0); PointPair end = new PointPair(R, (minH + maxH) / 2.0); lineOfSight = new LineItem("Линия прямой видимости", new PointPairList(), Color.Blue, SymbolType.None); lineOfSight.AddPoint(begin.X, begin.Y + antennaH); lineOfSight.AddPoint(end.X, end.Y + antennaH); PointPairList points = new PointPairList(); double x = 0; double stepX = R / 500; while (x <= R) { points.Add(x, getEarthCurveH(x)); x += stepX; } earthCurve = new ZedGraph.LineItem("Дуга кривизны земной поверхности", points, Color.Green, SymbolType.None); graphPane.CurveList.Clear(); profile = new Profile(begin, end, this); bariers = new List<Barier>(); H0 = new PointPairList(); x = 0; double step = 0.01; while (x <= R) { H0.Add(x, getH0(x)); x += step; } }
public void AddPointToLine(double xValue, double yValue) { Line_1.AddPoint(xValue, yValue); zedGraphCtrl.Invalidate( ); zedGraphCtrl.AxisChange( ); }
public CurveInfo(string modifiedSequence, Color peptideColor, double retentionTime, float intensity) { Curve = new LineItem(string.Empty, new PointPairList(), peptideColor, SymbolType.None) { Line = { Fill = new Fill(Color.FromArgb(80, peptideColor)), Width = 1, IsAntiAlias = true }, Label = { IsVisible = false } }; Curve.AddPoint(retentionTime - ChromatogramLoadingStatus.TIME_RESOLUTION, 0); Curve.AddPoint(retentionTime, intensity); Curve.AddPoint(retentionTime + ChromatogramLoadingStatus.TIME_RESOLUTION, 0); ModifiedSequence = modifiedSequence; }
private void FillCorrelation(Series s1, Series s2, LineItem series1) { int sz = s1.Count; for (int i = 0; i < sz; i++) { Point pt = s1[i]; if (!pt.IsMissing) { int idx = s2.IndexOf(pt.DateTime); if (idx >= 0) { Point pt2 = s2[idx]; if (!pt2.IsMissing) { series1.AddPoint(pt.Value, pt2.Value); } } } } }
private bool ZG_MouseUpEvent(ZedGraphControl control, MouseEventArgs e) { if (!e.Button.Equals(MouseButtons.Left)) { return(false); } // indicate to the mouse movement event that we finished with the measurer-beam m_MeasurerActivated = false; // calculate the distance var ds = 1.0; if ((m_Control.GraphPane.XAxis.Type == AxisType.Date) || (m_Control.GraphPane.XAxis.Type == AxisType.DateAsOrdinal)) { switch (m_Control.GraphPane.XAxis.Scale.MajorUnit) { case DateUnit.Year: ds = 1.0 / 365.0; break; case DateUnit.Day: ds = 1.0; break; case DateUnit.Hour: ds = 24.0; break; case DateUnit.Minute: ds = 24.0 * 60.0; break; case DateUnit.Second: ds = 24.0 * 60.0 * 60.0; break; case DateUnit.Millisecond: ds = 24.0 * 60.0 * 60.0 * 1000.0; break; } } double dx = (m_MeasurerBeam.Points[1].X - m_MeasurerBeam.Points[0].X) * ds; double dy = m_MeasurerBeam.Points[1].Y - m_MeasurerBeam.Points[0].Y; double distance = Math.Sqrt(Math.Pow(dx, 2) + Math.Pow(dy, 2)); // if this is only a point and not an actual measurer beam - remove it // otherwise, add it to our "watch-list" if (distance == 0.0) { m_Control.GraphPane.CurveList.Remove(m_MeasurerBeam); } else { // calculate the position for the text double cx = (m_MeasurerBeam.Points[1].X + m_MeasurerBeam.Points[0].X) / 2; double cy = (m_MeasurerBeam.Points[1].Y + m_MeasurerBeam.Points[0].Y) / 2; // calculate the angle for the text (must be done in screen coordinates) PointF p1 = control.GraphPane.GeneralTransform(m_MeasurerBeam.Points[0].X, m_MeasurerBeam.Points[0].Y, Coord); PointF p2 = control.GraphPane.GeneralTransform(m_MeasurerBeam.Points[1].X, m_MeasurerBeam.Points[1].Y, Coord); // add text to describe the distance (if one dimension is much bigger than the other // AND axes type are different - create a text only for the bigger dimension) var text = new TextObj($"{distance:N3}", cx, cy, Coord, AlignH.Center, AlignV.Bottom); if (!m_Control.GraphPane.YAxis.Type.Equals(m_Control.GraphPane.XAxis.Type)) { double dpx = Math.Abs(p2.X - p1.X); double dpy = Math.Abs(p2.Y - p1.Y); if (dpx > 20.0 * dpy) { text.Text = $"{Math.Abs(dx):N3} [ {m_Control.GraphPane.XAxis.Scale.MajorUnit}s ]"; } else if (dpy > 20.0 * dpx) { text.Text = $"{Math.Abs(dy):N3} [ {m_Control.GraphPane.YAxis.Type} ]"; } } text.FontSpec.Angle = 0.0f; // Convert.ToSingle(-Math.Atan((p2.Y - p1.Y) / (p2.X - p1.X)) * 180.0 / Math.PI); text.FontSpec.FontColor = m_FontColor; text.FontSpec.Size = m_FontSize; text.FontSpec.Border.IsVisible = false; m_Control.GraphPane.GraphObjList.Add(text); // add tooltip to describe the distance (and add a point in the middle) var dXdYstr = $"Distance: {distance:N3}\ndy: {Math.Abs(dy):N3} [{m_Control.GraphPane.YAxis.Type}]\n" + $"dx: {Math.Abs(dx):N3} [{m_Control.GraphPane.XAxis.Scale.MajorUnit}]"; m_MeasurerBeam.AddPoint(cx, cy); for (int i = 0; i < 3; i++) { m_MeasurerBeam.Points[i].Tag = dXdYstr; } // add curve and its text to the "watch-list" m_MeasurerBeamTextList.Add(text); m_MeasurerBeamList.Add(m_MeasurerBeam); } // force a redraw control.Refresh(); // tell the ZedGraphControl not to do anything else with this event return(true); }
private void FrmMain_Load(object sender, EventArgs args) { gPane1 = zgGraph1.GraphPane; gPane2 = zgGraph2.GraphPane; gPane3 = zgGraph3.GraphPane; InitGraphPane(gPane1, "Log(n)^2 (n = Network Size)", "Total Bits Sent"); InitGraphPane(gPane2, "Log(n) (n = Network Size)", "Total Search Time (ms)"); InitGraphPane(gPane3, "Log(n) (n = Network Size)", "Avg. Space Per Node (bits)"); //InitGraphPane(gPane1, "Network Size", "Total Bits Sent"); //InitGraphPane(gPane2, "Network Size", "Total Search Time (ms)"); //InitGraphPane(gPane3, "Network Size", "Avg. Space Per Node (bits)"); curveMessages = gPane1.AddCurve("Total Bits Sent vs. Size of Network", null, Color.Blue, SymbolType.None); curveTime = gPane2.AddCurve("Total Search Time vs. Size of Network", null, Color.Red, SymbolType.None); curveMemory = gPane3.AddCurve("Total Memory vs. Size of Network", null, Color.Green, SymbolType.None); curveMessages.Line.Width = 1.6F; curveMessages.Line.IsAntiAlias = true; curveTime.Line.Width = 1.6F; curveTime.Line.IsAntiAlias = true; curveMemory.Line.Width = 1.6F; curveMemory.Line.IsAntiAlias = true; for (int i = 6; i < 11; i++) { var bn = new ButterflyNetwork<Image>(); // 842667722 n = (int)Math.Pow(2, i); int B = 3, C = 3, D = 3, T = 3; double a = 0.1, b = 6.5; //int n = (int)Math.Pow(2, i); //double e = 0.05; //double d = 0.9; //double a = 0.25; //double ap = 0.095; //double b = 1.001; //double g = 0.2; //int B = (int)Math.Round(1 / g * Math.Log(Math.E/e, Math.E)); //int C = (int)Math.Round(10 / 3 * (2 * Math.Log(2 * Math.E, Math.E)) / (d * (1 - g) * Math.Pow(1 - (2 * a), 2))); //int D = (int)Math.Round(b / (ap * (a - ap)) * (ap * Math.Log(b * Math.E / ap, Math.E) + (a - ap) * Math.Log(b * Math.E / (a - ap), Math.E) + 2/C)); //int T = (int)Math.Round(1 / (1 - d) * Math.Log(Math.E / e, Math.E)); bn.InitializationFinished += new ButterflyNetwork<Image>.InitializationHandler(bn_InitializationFinished); bn.SearchStarted += new ButterflyNetwork<Image>.SearchFinishedHandler(bn_SearchStarted); bn.SearchFinished += new ButterflyNetwork<Image>.SearchFinishedHandler(bn_SearchFinished); bn.InitializeNetwork(n, B, C, D, T, a, b); var images = new List<ImageDataItem>(); var filePaths = Directory.GetFiles(@"c:\images256"); foreach (var filePath in filePaths.Take(2)) { images.Add(new ImageDataItem(filePath)); } bn.StoreDataItems(images); var query = new ImageDataItem() { Title = Path.GetFileNameWithoutExtension(filePaths[0]) }; bn.Search(query, 8); bn.Run(); curveMessages.AddPoint(n, bn.SentSize * 8 / n); zgGraph1.RestoreScale(gPane1); } }