/// <summary> /// Takes "bukalemun" values, converts them to "pixelated" values and saves for next drawing. /// </summary> /// <param name="dataPoints">An IEnumerable set of bukalemun type data points</param> public void SetPoints(IEnumerable <DataPoint> dataPoints) { // Convert bukalemunDataPoints into pixelatedDataPoints and add them to Ellipses & Polyliner classes //hypothetical == bukalemun? PointMarks.Reset(); Polyliner.Reset(); DataPoint temp_PixelatedDataPoint; foreach (DataPoint bukalemunDataPoint in dataPoints) { // Linear mapping from imagined "bukalemun 2D plane" to real "pixelated 2D plane" temp_PixelatedDataPoint = bukalemunDataPoint; temp_PixelatedDataPoint.X = AxesWithOrigin.Origin.Item1 + temp_PixelatedDataPoint.X * AxesWithOrigin.XScalingFactor; temp_PixelatedDataPoint.Y = AxesWithOrigin.Origin.Item2 + temp_PixelatedDataPoint.Y * AxesWithOrigin.YScalingFactor; // Add the result of transformation as both a circle to the Ellipses and point to the Polyliner PointMarks.AddPoint(bukalemunDataPoint, temp_PixelatedDataPoint); Polyliner.AddPoint(new System.Windows.Point(temp_PixelatedDataPoint.X, temp_PixelatedDataPoint.Y)); } }
// Constructor function public Plotter(Canvas c) { // set properties CanvasToDrawOn = c; PointMarksVisible = false; PolylineVisible = true; PointMarks = new PointMarks(MarkerType.Triangle); Polyliner = new Polyliner(); AutoIncrementedDataPoints = new List <DataPoint>(); CanvasToDrawOn.Width = 650; CanvasToDrawOn.Height = 300; AxesWithOrigin = new AxesWithOrigin(CanvasToDrawOn.Width, CanvasToDrawOn.Height); // Instead of "AxesWithOrigin(double width, double height)" one can prefer "AxesWithOrigin(double width, double height, Tuple origin)" as default action like shown down below // AxesWithOrigin = new AxesWithOrigin(CanvasToDrawOn.Width, CanvasToDrawOn.Height, new System.Tuple<double, double>(CanvasToDrawOn.Width / 2, CanvasToDrawOn.Height)); CanvasToDrawOn.Background = new SolidColorBrush(Colors.WhiteSmoke); }
public void ResetAll() { AutoIncrementedDataPoints.Clear(); PointMarks.Reset(); Polyliner.Reset(); }