﻿// TraceLab - Software Traceability Instrument to Facilitate and Empower Traceability Research
// Copyright (C) 2012-2013 CoEST - National Science Foundation MRI-R2 Grant # CNS: 0959924
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see<http://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;

namespace ResultsVisualization.Charts
{
    /// <summary>
    /// Data structure for each set of points in a Line Series Chart
    /// </summary>
    public class LineData
    {
        #region Members

        protected string name;
        public string Name
        {
            get { return this.name; }
            set { this.name = value; }
        }

        protected Brush color = Brushes.Black;
        public Brush Color
        {
            get { return this.color; }
            set { this.color = value; }
        }

        private List<Point> points;
        public List<Point> Points
        {
            get { return this.points; }
            set { this.points = value; }
        }

        #endregion

        public LineData()
        {
            this.Points = new List<Point>();
        }

        public void AddPoint(Point p)
        {
            this.points.Add(p);
        }

        public void Draw(ChartStyle chart)
        {
            Polyline pl = new Polyline();

            foreach (Point p in this.points)
            {
                pl.Points.Add(chart.NormalizePoint(p));
            }

            pl.Stroke = this.color;
            pl.StrokeThickness = 1.5d;

            chart.ChartCanvas.Children.Add(pl);
        }
    }
}
