public void UpdatePointValue(string pointName, params double[] valueList) { PointStorage point = GetPoint(pointName); if (point != null) { point.AddRobotPoint(valueList); } }
// Methods ------------------------------------------------------------- public void CreatePoint(string pointName, int queueSize, params string[] dimensionNames) { int dimension = dimensionNames.Length; PointStorage pointStorage = new PointStorage(pointName, dimension, queueSize, dimensionNames); points.Add(pointName, pointStorage); pointStorage.OnAddPoint += new Seagate.AAS.Utils.PointStore.PointStorage.OnAddPointHandler(PublishUpdateEvent); }
private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e) { int index = comboBox1.SelectedIndex; PointStorage ps = (PointStorage)pointStore.Points[listPoints.SelectedItem]; double[] chartValues = new double[ps.History.Count]; for (int i = 0; i < ps.History.Count; i++) { chartValues[i] = ((RobotPoint)ps.History[i]).Coordinate[index]; } simpleChart1.Text = comboBox1.Items[index].ToString(); simpleChart1.YValues = chartValues; }
// added to make getting point values less verbose for classes that just want access to the current point value (diagnostic screens, et.c.) -- HG public double GetCurrentPointValue(string pointName, string coordName) { PointStorage point = GetPoint(pointName); // find index of coordName for (int i = 0; i < point.Dimension; i++) { if (point.DimensionName[i] == coordName) { return(point.CurrentPoint[i]); } } //string msg = string.Format("{0} is not a valid dimension in for Point {1}",coordName,pointName); //throw new ParselException(msg); return(0.0); }
public PointStorage GetPoint(string pointName, string[] dimensionNames, double[] defaultValues) { if (!points.Contains(pointName)) { CreatePoint(pointName, 10, dimensionNames); GetPoint(pointName).AddRobotPoint(defaultValues); Save(); } else { if (((PointStorage)points[pointName]).Dimension != dimensionNames.Length) { PointStorage oldPoint = (PointStorage)points[pointName]; // remove old point from list points.Remove(pointName); // create new point CreatePoint(pointName, 10, dimensionNames); PointStorage newPoint = GetPoint(pointName); // copy old values to new point for (int j = oldPoint.History.Count - 1; j >= 0; j--) { RobotPoint p = (RobotPoint)oldPoint.History[j]; double[] val = new double[newPoint.Dimension]; for (int i = 0; i < val.Length; i++) { if (i < p.Coordinate.Length) { val[i] = p.Coordinate[i]; } else { val[i] = defaultValues[i]; } } newPoint.AddRobotPoint(val); } Save(); } } return((PointStorage)points[pointName]); }
private void UpdateDisplay() { selectedPoint = (PointStorage)pointStore.Points[listPoints.SelectedItem]; // publish event if (OnTreeViewSelect != null) { OnTreeViewSelect(); } listView1.BeginUpdate(); if (radioViewList.Checked) { listView1.Clear(); listView1.Columns.Add("Index", 50, HorizontalAlignment.Center); listView1.Columns.Add("Time Stamp", 150, HorizontalAlignment.Center); for (int col = 0; col < selectedPoint.Dimension; col++) { listView1.Columns.Add(selectedPoint.DimensionName[col], 70, HorizontalAlignment.Right); } for (int index = 0; index < selectedPoint.History.Count; index++) { RobotPoint point = (RobotPoint)selectedPoint.History[index]; ListViewItem item = new ListViewItem(index.ToString()); item.Tag = point; item.SubItems.Add(point.TimeStamp.ToString()); foreach (double val in point.Coordinate) { item.SubItems.Add(val.ToString("0.000")); } listView1.Items.Add(item); } } else if (radioStatistics.Checked) { listView1.Clear(); listView1.Columns.Add("Dimension", 100, HorizontalAlignment.Center); listView1.Columns.Add("Average", 70, HorizontalAlignment.Center); listView1.Columns.Add("Stdev", 70, HorizontalAlignment.Center); listView1.Columns.Add("Min", 70, HorizontalAlignment.Center); listView1.Columns.Add("Max", 70, HorizontalAlignment.Center); for (int dimension = 0; dimension < selectedPoint.Dimension; dimension++) { ListViewItem item = new ListViewItem(selectedPoint.DimensionName[dimension]); item.SubItems.Add(selectedPoint.Average[dimension].ToString("0.000")); item.SubItems.Add(selectedPoint.Stdev[dimension].ToString("0.000")); item.SubItems.Add(selectedPoint.Min[dimension].ToString("0.000")); item.SubItems.Add(selectedPoint.Max[dimension].ToString("0.000")); listView1.Items.Add(item); } } else if (radioGraph.Checked) { comboBox1.Items.Clear(); foreach (string dimension in selectedPoint.DimensionName) { comboBox1.Items.Add(dimension); } if (comboBox1.Items.Count > 0) { comboBox1.SelectedIndex = 0; } } listView1.EndUpdate(); if (radioGraph.Checked) { comboBox1.Dock = DockStyle.Top; comboBox1.Visible = true; simpleChart1.BringToFront(); simpleChart1.Dock = DockStyle.Fill; simpleChart1.Visible = true; listView1.Dock = DockStyle.None; listView1.Visible = false; } else { comboBox1.Dock = DockStyle.None; comboBox1.Visible = false; simpleChart1.Dock = DockStyle.None; simpleChart1.Visible = false; listView1.Dock = DockStyle.Fill; listView1.Visible = true; } }