コード例 #1
0
ファイル: GuideStepsHistory.cs プロジェクト: daleghent/NINA
        private void RebuildGuideHistoryList()
        {
            lock (lockObj) {
                if (overallGuideSteps.Count > 0)
                {
                    var collection = new LinkedList <HistoryStep>();
                    var startIndex = overallGuideSteps.Count - historySize;
                    if (startIndex < 0)
                    {
                        startIndex = 0;
                    }
                    RMS.Clear();
                    for (int i = startIndex; i < overallGuideSteps.Count; i++)
                    {
                        var p = overallGuideSteps.ElementAt(i);
                        RMS.AddDataPoint(p.RADistanceRaw, p.DECDistanceRaw);
                        if (Scale == GuiderScaleEnum.ARCSECONDS)
                        {
                            p = p.AdjustPixelScale(PixelScale);
                        }
                        else
                        {
                            p = p.AdjustPixelScale(1);
                        }
                        collection.AddLast(p);
                    }

                    GuideSteps = new AsyncObservableLimitedSizedStack <HistoryStep>(historySize, collection);
                    CalculateMaximumDurationY();
                }
            }
        }
コード例 #2
0
ファイル: GuideStepsHistory.cs プロジェクト: daleghent/NINA
        public void AddGuideStep(IGuideStep step)
        {
            lock (lockObj) {
                var historyStep = HistoryStep.FromGuideStep(step, Scale == GuiderScaleEnum.PIXELS ? 1 : PixelScale);
                overallGuideSteps.AddLast(historyStep);

                if (GuideSteps.Count == HistorySize)
                {
                    var elementIdx = overallGuideSteps.Count - HistorySize;
                    if (elementIdx >= 0)
                    {
                        var stepToRemove = overallGuideSteps.ElementAt(elementIdx);
                        RMS.RemoveDataPoint(stepToRemove.RADistanceRaw, stepToRemove.DECDistanceRaw);
                    }
                }

                RMS.AddDataPoint(step.RADistanceRaw, step.DECDistanceRaw);

                GuideSteps.Add(historyStep);
                CalculateMaximumDurationY();
            }
        }