예제 #1
0
 private void FinishExport(string message)
 {
     m_ConvertVideoToFitsController.FinishExport();
     m_ControlPanel.ExportFinished();
     m_Status = ConvertVideoToFitsState.Finished;
     m_VideoController.ShowMessageBox(message, "Tangra", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
예제 #2
0
        public void NextFrame(int frameNo, MovementType movementType, bool isLastFrame, AstroImage astroImage, int firstFrameInIntegrationPeriod, string fileName)
        {
            m_ControlPanel.NextFrame(frameNo, m_Status);

            if (m_Status == ConvertVideoToFitsState.Converting)
            {
                var   timestamp       = DateTime.MinValue;
                float exposureSeconds = 0;

                if (m_VideoController.HasTimestampOCR())
                {
                    m_OCRedTimeStamp = m_VideoController.OCRTimestamp();

                    timestamp = m_OCRedTimeStamp;
                    if (m_AttachDateToOCR.HasValue)
                    {
                        timestamp = m_AttachDateToOCR.Value.Date.Add(timestamp.TimeOfDay);
                        if (m_PrevOCRedTimeStamp.HasValue && m_PrevOCRedTimeStamp.Value > timestamp &&
                            timestamp.Hour == 23 && timestamp.Hour == 0)
                        {
                            timestamp         = timestamp.AddDays(1);
                            m_AttachDateToOCR = m_AttachDateToOCR.Value.AddDays(1);
                        }
                    }

                    if (m_PrevOCRedTimeStamp.HasValue)
                    {
                        exposureSeconds = (float)new TimeSpan(timestamp.Ticks - m_PrevOCRedTimeStamp.Value.Ticks).TotalSeconds;
                    }
                    else
                    {
                        var nextTimeStamp = m_VideoController.GetNextFrameOCRTimestamp();
                        if (nextTimeStamp != DateTime.MinValue)
                        {
                            exposureSeconds = (float)new TimeSpan(nextTimeStamp.TimeOfDay.Ticks - timestamp.TimeOfDay.Ticks).TotalSeconds;
                        }
                    }
                    m_PrevOCRedTimeStamp = timestamp;
                }
                else
                {
                    if (m_VideoController.HasEmbeddedTimeStamps())
                    {
                        timestamp       = astroImage.Pixelmap.FrameState.CentralExposureTime;
                        exposureSeconds = astroImage.Pixelmap.FrameState.ExposureInMilliseconds / 1000.0f;
                    }
                    else
                    {
                        timestamp       = m_StartFrameTime.AddTicks((long)(frameNo - m_StartTimeFrame) * (m_EndFrameTime.Ticks - m_StartFrameTime.Ticks) / (m_EndTimeFrame - m_StartTimeFrame));
                        exposureSeconds = (float)(new TimeSpan((m_EndFrameTime.Ticks - m_StartFrameTime.Ticks) / (m_EndTimeFrame - m_StartTimeFrame)).TotalSeconds);
                    }
                }

                m_ConvertVideoToFitsController.ProcessFrame(frameNo, astroImage, timestamp, exposureSeconds);

                if (isLastFrame || m_LastFrame == frameNo)
                {
                    m_ConvertVideoToFitsController.FinishExport();
                    m_ControlPanel.ExportFinished();
                    m_Status = ConvertVideoToFitsState.Finished;
                    m_VideoController.ShowMessageBox("Export completed.", "Tangra", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                if (m_LastFrame == frameNo)
                {
                    m_VideoController.StopVideo();
                }
            }
        }