Ejemplo n.º 1
0
        public void OnDialogOpened(IDialogParameters parameters)
        {
            PatternA = JsonSerializer.Deserialize <List <Point> >(parameters.GetValue <string>("patternA"));
            PatternB = JsonSerializer.Deserialize <List <Point> >(parameters.GetValue <string>("patternB"));

            var distance = Histogram.Distance(PatternA, PatternB);
            var histoSet = Histogram.CreateBins(distance, 50);

            PulseTableA = GetWrongPulses(PatternA, distance, 500);
            PulseTableB = GetWrongPulses(PatternB, distance, 500);

            HistoTable = histoSet.ToObservableCollection();

            PlotModelPatternA.Series.Add(GenerateScatterSeries(PatternA, distance));
            PlotModelPatternB.Series.Add(GenerateScatterSeries(PatternB, distance));

            PlotModelPatternA.InvalidatePlot(true);
            PlotModelPatternB.InvalidatePlot(true);

            PlotModelHisto.Series.Clear();
            PlotModelHisto.Series.Add(PlotModelHelper.CreateBarSeries(ConvertToDataPoint(histoSet)));
            PlotModelHisto.Axes.Add(new CategoryAxis {
                Position = AxisPosition.Bottom, Key = "y", Angle = 90, ItemsSource = histoSet, LabelField = "X"
            });
            PlotModelHisto.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left, MinimumPadding = 0, MaximumPadding = 0.06, AbsoluteMinimum = 0, Key = "x"
            });
            PlotModelHisto.InvalidatePlot(true);
        }
        public void OnDialogOpened(IDialogParameters parameters)
        {
            var refPattern  = JsonSerializer.Deserialize <List <Point> >(parameters.GetValue <string>("patternA"));
            var movePattern = JsonSerializer.Deserialize <List <Point> >(parameters.GetValue <string>("patternB"));

            var centers = new List <Point>();

            for (var i = 1; i < refPattern.Count; i++)
            {
                centers.Add((Point)(refPattern[i] - movePattern[i]));
            }

            PlotModelPatternA.Series.Add(PlotModelHelper.CreateScatterSerie(centers));
            PlotModelPatternA.Series.Add(PlotModelHelper.CreateHotZone(centers[0], 1500, OxyColors.Red));
            PlotModelPatternA.InvalidatePlot(true);
        }