예제 #1
0
 public void AddingPointDoesNotRemoveFirstPointIfUnderTheLimit()
 {
     graph.MaximumNumberOfPoints = 3;
     line.AddPoint(new Vector2D(1, 0));
     line.AddPoint(new Vector2D(2, 0));
     Assert.AreEqual(2, line.points.Count);
     line.AddPoint(new Vector2D(3, 0));
     Assert.AreEqual(3, line.points.Count);
 }
예제 #2
0
        public void AddThirdPointAtTheEnd()
        {
            GraphLine line = CreateLineWithTwoPoints();

            line.AddPoint(new Vector2D(0.8f, 0.5f));
            Assert.AreEqual(3, line.points.Count);
            Assert.AreEqual(2, line.lines.Count);
            Line2D line2D = line.lines[1];

            Assert.IsTrue(line2D.StartPoint.IsNearlyEqual(new Vector2D(0.538f, 0.462f)));
            Assert.IsTrue(line2D.EndPoint.IsNearlyEqual(new Vector2D(0.6143f, 0.5f)));
        }
예제 #3
0
        public void AddThirdPointInTheMiddle()
        {
            GraphLine line = CreateLineWithTwoPoints();

            line.AddPoint(new Vector2D(0.5f, 0.4f));
            Assert.AreEqual(3, line.points.Count);
            Assert.AreEqual(2, line.lines.Count);
            Line2D line0 = line.lines[0];

            Assert.IsTrue(line0.StartPoint.IsNearlyEqual(new Vector2D(0.462f, 0.5f)));
            Assert.IsTrue(line0.EndPoint.IsNearlyEqual(new Vector2D(0.5f, 0.519f)));
            Line2D line1 = line.lines[1];

            Assert.IsTrue(line1.StartPoint.IsNearlyEqual(new Vector2D(0.5f, 0.519f)));
            Assert.IsTrue(line1.EndPoint.IsNearlyEqual(new Vector2D(0.538f, 0.462f)));
        }
예제 #4
0
        public void AddMeasurementToCollection(GraphLineCollection coll, string Graphname, string SymbolName, DateTime Timestamp, float value, float minrange, float maxrange, Color linecolor)
        {
            bool _linefound = false;
            foreach (GraphLine line in coll)
            {
                if (line.Symbol == SymbolName)
                {
                    _linefound = true;
                    //                    if (value < minrange) minrange = value - 5;
                    //                    if (value > maxrange) maxrange = value + 5;

                    line.AddPoint(value, Timestamp, minrange, maxrange, linecolor);
                    break;
                }
            }
            if (!_linefound)
            {
                GraphLine _newline = new GraphLine();
                _newline.Symbol = SymbolName;
                _newline.NumberOfDecimals = GetChannelResolution(SymbolName);
                _newline.ChannelName = Graphname;
                _newline.Clear();
                coll.Add(_newline);
                _newline.AddPoint(value, Timestamp, minrange, maxrange, linecolor);
                _newline.LineVisible = GetRegistryValue(Graphname);
            }
        }
예제 #5
0
        public void AddMeasurement(string Graphname, string SymbolName, DateTime Timestamp, float value, float minrange, float maxrange, Color linecolor)
        {
            bool _linefound = false;
            foreach (GraphLine line in _lines)
            {
                if (line.Symbol == SymbolName)
                {
                    _linefound = true;
            //                    if (value < minrange) minrange = value - 5;
            //                    if (value > maxrange) maxrange = value + 5;

                    line.AddPoint(value, Timestamp, minrange, maxrange, linecolor);
                    break;
                }
            }
            if (!_linefound)
            {
                GraphLine _newline = new GraphLine();
                _newline.Symbol = SymbolName;
                _newline.NumberOfDecimals = GetChannelResolution(SymbolName);
                _newline.ChannelName = Graphname;
                _newline.Clear();
                _lines.Add(_newline);
            //                if (value < minrange) minrange = value;
            //                if (value > maxrange) maxrange = value;
                _newline.AddPoint(value, Timestamp, minrange, maxrange, linecolor);
                // set visible or invisible according to registry setting
                _newline.LineVisible = GetRegistryValue(Graphname);
                if (_newline.ChannelName == "KnockInfo") _newline.LineVisible = false;
                if (_newline.ChannelName == "Idle") _newline.LineVisible = false;
                if (_newline.ChannelName == "ClosedLoop") _newline.LineVisible = false;
                if (_newline.ChannelName == "Warmup") _newline.LineVisible = false;
            }
        }
 public void RenderGraph()
 {
     line.AddPoint(new Vector2D(-1.0f, -1.0f));
     line.AddPoint(new Vector2D(0.0f, 0.5f));
     line.AddPoint(new Vector2D(1.0f, 1.0f));
     line.AddPoint(new Vector2D(1.5f, -2.0f));
 }