Ejemplo n.º 1
0
        public TimeSample HitTest(Point pt)
        {
            if (List != null)
            {
                SDrawInfo info = GetDrawInfo();

                foreach (TimeSample ts in List)
                {
                    if (info.ToX(ts.Dist) > pt.X)
                    {
                        return(ts);
                    }
                }
            }
            return(null);
        }
Ejemplo n.º 2
0
        private void DrawWayPoints(DrawingContext context)
        {
            if (List == null)
            {
                return;
            }

            SDrawInfo drw = GetDrawInfo();

            SysPointPen.Freeze();
            XPointPen.Freeze();
            YPointPen.Freeze();
            ZPointPen.Freeze();
            GridPen.Freeze();

            var pt1 = new Point();
            var pt2 = new Point();

            pt1.X = 0;
            pt1.Y = drw.ToY(0);

            pt2.X = ActualWidth;
            pt2.Y = pt1.Y;

            context.DrawLine(GridPen, pt1, pt2);

            for (int i = 1; i < 5; i++)
            {
                pt1.Y = drw.ToY(-i * 100000);
                pt2.Y = pt1.Y;
                context.DrawLine(GridPen, pt1, pt2);

                pt1.Y = drw.ToY(i * 100000);
                pt2.Y = pt1.Y;
                context.DrawLine(GridPen, pt1, pt2);
            }

            // Draw all points
            foreach (TimeSample ts in List)
            {
                pt1.X = drw.ToX(ts.Dist);
                pt2.X = pt1.X + 1;

                if (pt1.X > drw.aX)
                {
                    break;
                }
                if (pt1.X < 0)
                {
                    continue;
                }

/*
 *                              pt1.Y = aY - ts.SysSpeed * scaleY + offsetY;
 *                              pt2.Y = pt1.Y + 1;
 *
 *                              context.DrawLine(SysPointPen, pt1, pt2);
 */
                if (ts.XSpeed != 0)
                {
                    pt1.Y = drw.ToY(ts.XSpeed);
                    pt2.Y = pt1.Y + 1;
                    context.DrawLine(XPointPen, pt1, pt2);
                }
                if (ts.YSpeed != 0)
                {
                    pt1.Y = drw.ToY(ts.YSpeed);
                    pt2.Y = pt1.Y + 1;
                    context.DrawLine(YPointPen, pt1, pt2);
                }
                if (ts.ZSpeed != 0)
                {
                    pt1.Y = drw.ToY(ts.ZSpeed);
                    pt2.Y = pt1.Y + 1;
                    context.DrawLine(ZPointPen, pt1, pt2);
                }
            }
        }