SDrawInfo GetDrawInfo() { var info = new SDrawInfo { distFrom = List.DistFrom, aY = ActualHeight / 2, aX = ActualWidth, scaleX = ActualWidth / (List.DistTo - List.DistFrom) * ScaleX, scaleY = ActualHeight / List.MaxSpeed / 2 * ScaleY, offsetX = OffsetX, offsetY = OffsetY }; return(info); }
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); }
SDrawInfo GetDrawInfo() { SDrawInfo info = new SDrawInfo(); info.distFrom = List.DistFrom; info.aY = ActualHeight / 2; info.aX = ActualWidth; info.scaleX = ActualWidth / (List.DistTo - List.DistFrom) * ScaleX; info.scaleY = ActualHeight / List.MaxSpeed / 2 * ScaleY; info.offsetX = OffsetX; info.offsetY = OffsetY; return info; }
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); } } }