/// <summary>
        /// Initialize the <see cref="PlotterRangeSelection"/> structure using the watch variable data loaded into the <see cref="HistoricDataManager"/> class.
        /// If the data to be displayed is not a fault log or a simulated fault log, <paramref name="tripTime"/> will be ignored.
        /// </summary>
        /// <param name="tripTime">The time of the trip if the data represents a fault log or a simulated fault log; otherwise DateTime.Now.</param>
        protected override void InitializePlotterRangeSelection(DateTime tripTime)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            PlotterRangeSelection.DataIntervalMs = WatchFile.DataStream.FrameIntervalMs;
            PlotterRangeSelection.TripTime       = tripTime;

            // Round the start time down to the nearest resolution.
            int msComponent = m_HistoricDataManager.FramesToDisplay[0].CurrentDateTime.Millisecond;
            int adjust      = msComponent % ResolutionLogFileMs;

            PlotterRangeSelection.InitialStartTime = m_HistoricDataManager.FramesToDisplay[0].CurrentDateTime.Subtract(new TimeSpan(0, 0, 0, 0, adjust));

            // Round the stop time up to the nearest resolution.
            msComponent = m_HistoricDataManager.FramesToDisplay[m_HistoricDataManager.FramesToDisplay.Count - 1].CurrentDateTime.Millisecond;
            adjust      = msComponent % ResolutionLogFileMs;
            if (adjust > 0)
            {
                adjust = PlotterRangeSelection.DataIntervalMs - adjust;
            }
            PlotterRangeSelection.InitialStopTime = m_HistoricDataManager.FramesToDisplay[m_HistoricDataManager.FramesToDisplay.Count - 1].CurrentDateTime.Add(new TimeSpan(0, 0, 0, 0, adjust));

            // Set the start time of the trip recording to be the exact duration of the fault-log before the stop time.
            int exactDurationMs = WatchFile.DataStream.DurationMs - WatchFile.DataStream.FrameIntervalMs;

            PlotterRangeSelection.InitialStartTime = PlotterRangeSelection.InitialStopTime.Subtract(new TimeSpan(0, 0, 0, (int)(exactDurationMs / 1000), (int)(exactDurationMs % 1000)));

            // Copy the initial values to the current values and calculate the time span.
            PlotterRangeSelection.Reset();
        }
Exemple #2
0
        /// <summary>
        /// Initialize the <see cref="PlotterRangeSelection"/> structure using the watch variable data loaded into the <see cref="HistoricDataManager"/> class.
        /// If the data to be displayed is not a fault log or a simulated fault log, <paramref name="tripTime"/> will be ignored.
        /// </summary>
        /// <param name="tripTime">The time of the trip if the data represents a fault log or a simulated fault log; otherwise DateTime.Now.</param>
        protected override void InitializePlotterRangeSelection(DateTime tripTime)
        {
            // Skip, if the Dispose() method has been called.
            if (IsDisposed)
            {
                return;
            }

            PlotterRangeSelection.DataIntervalMs   = WatchFile.DataStream.FrameIntervalMs;
            PlotterRangeSelection.TripTime         = tripTime;
            PlotterRangeSelection.InitialStartTime = m_HistoricDataManager.FramesToDisplay[0].CurrentDateTime;
            PlotterRangeSelection.InitialStopTime  = m_HistoricDataManager.FramesToDisplay[m_HistoricDataManager.FramesToDisplay.Count - 1].CurrentDateTime;

            // Copy the initial values to the current values and calculate the time span.
            PlotterRangeSelection.Reset();
        }