예제 #1
0
        public void FinishWithMeasurements()
        {
            if (!m_VideoController.IsRunning)
            {
                // Once we enter time entering mode we clear any integration
                m_VideoController.SetupFrameIntegration(1, FrameIntegratingMode.NoIntegration, PixelIntegrationType.Mean);
                m_VideoController.UpdateViews();

                m_StateMachine.VideoOperation.FinishedWithMeasurements();

                btnStop.Visible = false;
                btnLightCurve.Visible = false;
                gbxCorrections.Visible = false;
                m_CorrectTrackingTool = null;
                ucCorrSelection.CorrectTrackingTool = m_CorrectTrackingTool;

                if (!LightCurveReductionContext.Instance.HasEmbeddedTimeStamps)
                    PrepareToEnterStarTime();
                else
                    m_StateMachine.VideoOperation.ShowLightCurve(UsedTimeBase.EmbeddedTimeStamp);
            }
        }
예제 #2
0
        internal void UpdateState()
        {
            this.BackColor = SystemColors.Control;

            if (m_StateMachine == null) return;

            if (m_StateMachine.CurrentState == LightCurvesState.SelectTrackingStars ||
                m_StateMachine.CurrentState == LightCurvesState.SelectMeasuringStars)
            {
                pnlUserAction.Visible = true;
                pnlUserAction.BringToFront();
                pnlProcessing.Visible = false;
                pnlViewLightCurve.Visible = false;
                pnlEnterTimes.Visible = false;
                m_StoppedAtFrameNo = -1;
            }
            else if (
                m_StateMachine.CurrentState == LightCurvesState.ReadyToRun ||
                m_StateMachine.CurrentState == LightCurvesState.Running)
            {
                pnlEnterTimes.Visible = false;
                pnlUserAction.Visible = false;
                pnlProcessing.Visible = true;
                pnlProcessing.BringToFront();
                pnlViewLightCurve.Visible = false;
            }
            else if (m_StateMachine.CurrentState == LightCurvesState.SelectingFrameTimes)
            {
                btnStop.Visible = false;
                btnLightCurve.Visible = false;
                gbxCorrections.Visible = false;
                m_CorrectTrackingTool = null;
                ucCorrSelection.CorrectTrackingTool = m_CorrectTrackingTool;

                pnlProcessing.Visible = true;
                pnlProcessing.BringToFront();
                pnlEnterTimes.Visible = true;
                pnlUserAction.Visible = false;
                pnlViewLightCurve.Visible = false;
            }
            else if (m_StateMachine.CurrentState == LightCurvesState.Viewing)
            {
                pnlEnterTimes.Visible = false;
                pnlUserAction.Visible = false;
                pnlProcessing.Visible = false;
                pnlViewLightCurve.Visible = true;
                pnlViewLightCurve.BringToFront();
            }

            if (m_StateMachine.CurrentState == LightCurvesState.SelectMeasuringStars)
            {
                pnlTrackingSelection.BackColor = SystemColors.ControlLightLight;
                pnlTrackingSelection.BorderStyle = BorderStyle.FixedSingle;
                pnlMeasuringSelection.BackColor = SystemColors.ControlLightLight;
                pnlMeasuringSelection.BorderStyle = BorderStyle.FixedSingle;

                lblInfo.ForeColor = SystemColors.ControlText;
                if (m_StateMachine.MeasuringStars.Count == 0)
                {
                    btnStart.Enabled = false;
                    btnAdjustApertures.Visible = false;

                    lblInfo.Text =
                        "- Move to the first frame you want to measure\r\n" +
                        "- Select your first target\r\n" +
                        "- Press the 'Add Object' button";

                    lblInfo.BringToFront();

                    lblSignalMethod.Text = GetReductionMethodDisplayName(LightCurveReductionContext.Instance.ReductionMethod);
                    lblBackgroundMethod.Text = GetNoiseMethodDisplayName(LightCurveReductionContext.Instance.NoiseMethod);
                    lblMeasurementType.Text = GetReductionTypeDisplayName(LightCurveReductionContext.Instance.LightCurveReductionType, LightCurveReductionContext.Instance.LightCurveReductionSubType);

                    TangraContext.Current.CanScrollFrames = true;
                    m_VideoController.UpdateViews();
                }
                else
                {
                    lblInfo.Text = string.Empty;
                    // We need an occulted star before we can start
                    btnStart.Enabled = m_StateMachine.MeasuringStars.Find(m => m.TrackingType == TrackingType.OccultedStar) != null;
                    TangraContext.Current.CanScrollFrames = false;

                    if (m_StateMachine.MeasuringStars.Count > 1 && !btnAdjustApertures.Visible)
                    {
                        btnAdjustApertures.Visible = true;
                        btnAdjustApertures.BringToFront();
                    }
                    else if (m_StateMachine.MeasuringStars.Count < 2 && btnAdjustApertures.Visible)
                        btnAdjustApertures.Visible = false;
                }

                btnAddObject.Visible =
                    // If there is a selected object and this is not an added star
                    m_StateMachine.SelectedObject != null && m_StateMachine.SelectedMeasuringStar == -1;

                btnEditObject.Visible =
                    // If there is a selected object and it is an existing star
                    m_StateMachine.SelectedObject != null && m_StateMachine.SelectedMeasuringStar != -1;

                rbDisplayBrightness.Checked = TangraConfig.Settings.LastUsed.MeasuringZoomImageMode != 1;
                rbDisplayPixels.Checked = TangraConfig.Settings.LastUsed.MeasuringZoomImageMode == 1;
            }
            else
            {
                pnlTrackingSelection.BackColor = SystemColors.Control;
                pnlMeasuringSelection.BackColor = SystemColors.Control;
                pnlTrackingSelection.BorderStyle = BorderStyle.FixedSingle;
                pnlMeasuringSelection.BorderStyle = BorderStyle.FixedSingle;
            }

            if (m_StateMachine.CurrentState == LightCurvesState.Running)
            {
                if (m_StateMachine.VideoOperation.IsRefining)
                    btnStop.Text = "Cancel Measurements";
                else if (m_StateMachine.VideoOperation.IsMeasuring)
                    btnStop.Text = "Stop Measurements";

                btnLightCurve.Visible = false;
                gbxCorrections.Visible = false;
                m_CorrectTrackingTool = null;
                ucCorrSelection.CorrectTrackingTool = m_CorrectTrackingTool;

                pnlMeasureZoomOptions.Visible = m_StateMachine.VideoOperation.IsMeasuring;
            }

            UpdateLCData();
        }
예제 #3
0
        private void btnStop_Click(object sender, EventArgs e)
        {
            if (m_StoppedAtFrameNo != -1)
            {
                 // NOTE: If this was a manual correction of lost tracking we should continue from the previous frame (to correct the tracking and do a measurement)
                 //       Otherwise continue from the stopped frame
                int continueFromFrame = m_StopReason == StopReason.LostTracking
                                            ? m_StoppedAtFrameNo - 1
                                            : m_StoppedAtFrameNo;

                m_StateMachine.VideoOperation.ContinueMeasurements(continueFromFrame);
                m_StoppedAtFrameNo = -1;
                btnStop.Text = "Stop";

                btnLightCurve.Visible = false;
                gbxCorrections.Visible = false;
                m_CorrectTrackingTool = null;
                ucCorrSelection.CorrectTrackingTool = m_CorrectTrackingTool;
            }
            else
            {
                if (m_StateMachine.VideoOperation.IsRefining)
                {
                    StopRefining();
                }
                else
                {
                    StopMeasurements(StopReason.User);
                }
            }
        }
예제 #4
0
        public void StopMeasurements(StopReason reason)
        {
            m_StateMachine.VideoOperation.StopMeasurements((correctTrackingTool) =>
                {
                    m_CorrectTrackingTool = correctTrackingTool;
                    m_StoppedAtFrameNo = m_StateMachine.VideoOperation.m_CurrFrameNo;
                    m_StopReason = reason;

                    btnStop.Text = "Continue Measurements";

                    btnLightCurve.Visible = true;

                    if (m_CorrectTrackingTool.SupportsManualCorrections)
                    {
                        gbxCorrections.Visible = true;
                        ucCorrSelection.CorrectTrackingTool = m_CorrectTrackingTool;
                        ucCorrSelection.Reset();
                    }

                    m_VideoController.RefreshCurrentFrame();
                });
        }