/// <summary> /// a static function that returns the single instance of MinCircleDetector object /// </summary> /// /// <param name="csvFilePath"> a csv file where the flight's data is </param> /// <param name="colNames"> the names of the csv's columns </param> /// <returns> an insance of MinCircleDetector </returns> public static MinCircleDetector GetInstance(string csvFilePath, List <string> colNames) { if (instance == null) { instance = new MinCircleDetector(csvFilePath, colNames); } return(instance); }
/// <summary> /// CTOR of MinCircleGraph. /// </summary> /// <param name="csvFilePath"> a csv file which should be converted into Timeseries object </param> /// <param name="colNames"> the names of the csv's columns </param> public MinCircleGraph(string csvFilePath, List <string> colNames) { InitializeComponent(); // try use the MinCircleDetector instance in the vm constuctor vm = new MinCircleViewModel(MinCircleDetector.GetInstance(csvFilePath, colNames)); this.DataContext = vm; // draw x and y axis on the canvas Path xAxis = CreateAxis(new System.Windows.Point(margin, CircleGraph.Height / 2), new System.Windows.Point(CircleGraph.Width, CircleGraph.Height / 2)); CircleGraph.Children.Add(xAxis); Path yAxis = CreateAxis(new System.Windows.Point(CircleGraph.Width / 2, CircleGraph.Height), new System.Windows.Point(CircleGraph.Width / 2, 0)); CircleGraph.Children.Add(yAxis); }
/// <summary> /// CTOR of MinCircleVIewModel. /// </summary> /// <param name="model"> an object of MinCircleDetector </param> public MinCircleViewModel(MinCircleDetector model) { this.model = model; }