private void LogGPlotDisplay()
{
if (this.InvokeRequired)
{
if (!m_log_invoke)
{
m_log_invoke = true;
this.BeginInvoke(new EventLogDisplayHandler(LogGPlotDisplay));
}
return;
}
if (LogQueue.Count == 0 && GPlotQueue.Count == 0)
{
m_log_invoke = false;
return;
}
this.SuspendLayout();
while (LogQueue.Count > 0)
{
ListViewItem lvi = LogQueue.Dequeue();
Log.Items.Add(lvi);
}
if (Log.Items.Count > 0)
Log.EnsureVisible(Log.Items.Count - 1);
if (GPlotQueue.Count > 0)
{
while (GPlotQueue.Count > 0)
{
GPoint next = new GPoint(GPlotCurrent);
GPoint point = GPlotQueue.Dequeue();
if (point.X.HasValue) next.X = point.X.Value;
if (point.Y.HasValue) next.Y = point.Y.Value;
if (point.Z.HasValue) next.Z = point.Z.Value;
if (point.A.HasValue) next.A = point.A.Value;
if (point.B.HasValue) next.A = point.B.Value;
if (point.C.HasValue) next.C = point.C.Value;
GPlotGraphics.DrawLine(
(next.Z >= (float)ZLevel.Value)
? GPlotPenP
: GPlotPenM,
new Point(NormalizeX(GPlotCurrent.X.Value), NormalizeY(GPlotCurrent.Y.Value)),
new Point(NormalizeX(next.X.Value), NormalizeY(next.Y.Value))
);
GPlotCurrent = next;
}
GPlotPicture.Refresh();
}
CurrentX.Text = CurrentX2.Text = GPlotCurrent.X.HasValue ? GPlotCurrent.X.Value.ToString(Culture) : "-";
CurrentY.Text = CurrentY2.Text = GPlotCurrent.Y.HasValue ? GPlotCurrent.Y.Value.ToString(Culture) : "-";
CurrentZ.Text = CurrentZ2.Text = GPlotCurrent.Z.HasValue ? GPlotCurrent.Z.Value.ToString(Culture) : "-";
CurrentA.Text = CurrentA2.Text = GPlotCurrent.A.HasValue ? GPlotCurrent.A.Value.ToString(Culture) : "-";
this.ResumeLayout(false);
m_log_invoke = false;
}