Esempio n. 1
0
 public RobotPoint(RobotPoint copy)
 {
     this.dimension  = copy.dimension;
     this.timeStamp  = DateTime.Now;
     this.coordinate = new double[copy.Coordinate.Length];
     for (int i = 0; i < coordinate.Length; i++)
     {
         coordinate[i] = copy[i];
     }
 }
Esempio n. 2
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]);
        }
Esempio n. 3
0
        // Methods -------------------------------------------------------------
        public RobotPoint AddRobotPoint(params double[] doubleList)
        {
            UpdateStatistics(doubleList);

            RobotPoint point = new RobotPoint(dimension);

            point.Coordinate = doubleList;

            history.Insert(0, point);

            // remove oldest element(s) added (fifo)
            while (history.Count > queueSize)
            {
                history.RemoveAt(history.Count - 1);
            }

            if (OnAddPoint != null)
            {
                OnAddPoint();
            }

            return(point);
        }
Esempio n. 4
0
        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;
            }
        }