コード例 #1
0
ファイル: Graph.cs プロジェクト: ErnadS/LogPlotter
        public virtual void PaintLines(Graphics graphics)
        {
            int nCount = 0;

            if ((_isVisible == false) || (usedLength < 2)) //(_samples.Count < 2))
            {
                return;
            }

            lock (_lockObject)
            {
                _pixels = new CircularBuffer <Point>((int)usedLength); //_samples.Count);

                GraphPoint previous          = new GraphPoint();
                Point      previousProjected = new Point();
                bool       bFirst            = true;

                foreach (var sample in _samples)
                {
                    nCount++;

                    if (sample.X >= Projection.XMin && sample.X <= Projection.XMax)
                    {
                        Point p = projection.ConvertToScreenPoint(sample);
                        if (bFirst)
                        {
                            bFirst            = false;
                            previous          = sample;
                            previousProjected = p;
                        }
                        else if (sample.Y < 10000000 && sample.Y > -10000000)  // ovo je samo zbog neke greske u fazi koja uzrokuje da program ide u exception pa bude spor
                        {
                            try
                            {
                                if (!float.IsNaN(sample.Y) && !float.IsNaN(previous.Y))
                                {
                                    graphics.DrawLine(_graphPen, p.X, p.Y, previousProjected.X, previousProjected.Y);
                                }
                            }
                            catch
                            {
                                Console.WriteLine("Err. 229911: " + sample.Y + "   " + previous.Y);
                            }
                            // _pixels.Add(projection.ConvertToScreenPoint(sample));

                            previous          = sample;
                            previousProjected = p;
                        }
                        else
                        {
                            // Console.WriteLine("Err. 229912: " + sample.Y + "   " + previous.Y);
                        }
                    }
                }

                //  if (_pixels.Count > 1)
                //    graphics.DrawLines(_graphPen, _pixels.ToArray());
            }
        }
コード例 #2
0
ファイル: Graph.cs プロジェクト: ErnadS/LogPlotter
        public void PaintLines(Graphics graphics)
        {
            if ((_isVisible == false) || (_samples.Count < 2))
            {
                return;
            }

            lock (_lockObject)
            {
                _pixels = new CircularBuffer <Point>(_samples.Count);

                foreach (var sample in _samples)
                {
                    if (sample.X >= Projection.XMin && sample.X <= Projection.XMax)
                    {
                        _pixels.Add(projection.ConvertToScreenPoint(sample));
                    }
                }

                if (_pixels.Count > 1)
                {
                    graphics.DrawLines(_graphPen, _pixels.ToArray());
                }
            }
        }