示例#1
0
        public override void MouseClick(ObjectClickEventArgs e)
        {
            if (e.MouseEventArgs.Button == MouseButtons.Right && m_AstrometricState.ManualStarIdentificationMode)
            {
                m_AstrometryController.SetManuallyIdentifyStarState(false);
            }

            if (e.Pixel != null)
            {
                if ((m_AstrometricState.MeasuringState == AstrometryInFramesState.Ready || m_AstrometricState.MatchResult != PerformMatchResult.FitSucceessfull) &&
                    m_AstrometricState.ManualStarIdentificationMode &&
                    AstrometryContext.Current.FieldSolveContext.CatalogueStars != null &&
                    AstrometryContext.Current.FieldSolveContext.CatalogueStars.Count > 3)
                {
                    var          frmIdentifyCalibrationStar = new frmIdentifyCalibrationStar(AstrometryContext.Current.FieldSolveContext.CatalogueStars, m_AstrometricState.ManuallyIdentifiedStars, false);
                    DialogResult res = m_VideoController.ShowDialog(frmIdentifyCalibrationStar);
                    if (res == DialogResult.Abort)
                    {
                        m_AstrometricState.ManuallyIdentifiedStars.Clear();
                        m_AstrometryController.SetManuallyIdentifyStarState(false);
                    }
                    else if (res == DialogResult.OK && frmIdentifyCalibrationStar.SelectedStar != null)
                    {
                        var frmQuestion = new frmIdentifiedStarAction(m_AstrometricState);
                        if (m_VideoController.ShowDialog(frmQuestion) == DialogResult.OK)
                        {
                            m_AstrometricState.ManuallyIdentifiedStars.Add(e.Gausian, frmIdentifyCalibrationStar.SelectedStar);
                            m_AstrometryController.TriggerPlateReSolve();
                            m_AstrometryController.SetManuallyIdentifyStarState(false);
                        }
                        else
                        {
                            m_AstrometricState.ManuallyIdentifiedStars.Add(e.Gausian, frmIdentifyCalibrationStar.SelectedStar);
                            m_VideoController.RedrawCurrentFrame(false, true, false);
                        }
                    }
                }
                else if (m_AstrometricState.MeasuringState != AstrometryInFramesState.RunningMeasurements)
                {
                    AstrometricState astrometryTracker = AstrometryContext.Current.AstrometricState;
                    if (astrometryTracker != null &&
                        astrometryTracker.AstrometricFit != null)
                    {
                        var objInfo = new SelectedObject()
                        {
                            X0 = e.Pixel.XDouble, Y0 = e.Pixel.YDouble
                        };
                        astrometryTracker.AstrometricFit.GetRADEFromImageCoords(e.Pixel.XDouble, e.Pixel.YDouble, out objInfo.RADeg, out objInfo.DEDeg);
                        objInfo.FittedStar = astrometryTracker.AstrometricFit.FitInfo.GetFittedStar(e.Pixel);
                        objInfo.Solution   = astrometryTracker.AstrometricFit;
                        objInfo.Pixel      = e.Pixel;
                        objInfo.Gaussian   = e.Gausian;
                        if (m_AstrometricState.IdentifiedObjects != null)
                        {
                            objInfo.IdentifiedObject = m_AstrometricState.GetIdentifiedObjectAt(objInfo.RADeg, objInfo.DEDeg);
                        }
                        else
                        {
                            objInfo.IdentifiedObject = null;
                        }


                        // We don't want to reload the current frame as this will result in trying another Astrometric Fit
                        // So we send a message to the Astrometry component about the newly selected object
                        m_AstrometryController.NewObjectSelected(objInfo);

                        m_SelectedObject = objInfo;
                        m_VideoController.RedrawCurrentFrame(false, true, false);
                    }
                }
            }
        }
        public override void MouseClick(ObjectClickEventArgs e)
        {
            if (e.MouseEventArgs.Button == MouseButtons.Right && m_AstrometricState.ManualStarIdentificationMode)
            {
                m_AstrometryController.SetManuallyIdentifyStarState(false);
            }

            if (e.Pixel != null)
            {
                if ((m_AstrometricState.MeasuringState == AstrometryInFramesState.Ready || m_AstrometricState.MatchResult != PerformMatchResult.FitSucceessfull)
                    && m_AstrometricState.ManualStarIdentificationMode
                    && AstrometryContext.Current.FieldSolveContext.CatalogueStars != null
                    && AstrometryContext.Current.FieldSolveContext.CatalogueStars.Count > 3)
                {

                    var frmIdentifyCalibrationStar = new frmIdentifyCalibrationStar(AstrometryContext.Current.FieldSolveContext.CatalogueStars, m_AstrometricState.ManuallyIdentifiedStars, false);
                    DialogResult res = m_VideoController.ShowDialog(frmIdentifyCalibrationStar);
                    if (res == DialogResult.Abort)
                    {
                        m_AstrometricState.ManuallyIdentifiedStars.Clear();
                        m_AstrometryController.SetManuallyIdentifyStarState(false);
                    }
                    else if (res == DialogResult.OK && frmIdentifyCalibrationStar.SelectedStar != null)
                    {
                        var frmQuestion = new frmIdentifiedStarAction(m_AstrometricState);
                        if (m_VideoController.ShowDialog(frmQuestion) == DialogResult.OK)
                        {
                            m_AstrometricState.ManuallyIdentifiedStars.Add(e.Gausian, frmIdentifyCalibrationStar.SelectedStar);
                            m_AstrometryController.TriggerPlateReSolve();
                            m_AstrometryController.SetManuallyIdentifyStarState(false);
                        }
                        else
                        {
                            m_AstrometricState.ManuallyIdentifiedStars.Add(e.Gausian, frmIdentifyCalibrationStar.SelectedStar);
                            m_VideoController.RedrawCurrentFrame(false);
                        }
                    }
                }
                else if (m_AstrometricState.MeasuringState != AstrometryInFramesState.RunningMeasurements)
                {
                    AstrometricState astrometryTracker = AstrometryContext.Current.AstrometricState;
                    if (astrometryTracker != null &&
                        astrometryTracker.AstrometricFit != null)
                    {
                        var objInfo = new SelectedObject() { X0 = e.Pixel.XDouble, Y0 = e.Pixel.YDouble };
                        astrometryTracker.AstrometricFit.GetRADEFromImageCoords(e.Pixel.XDouble, e.Pixel.YDouble, out objInfo.RADeg, out objInfo.DEDeg);
                        objInfo.FittedStar = astrometryTracker.AstrometricFit.FitInfo.GetFittedStar(e.Pixel);
                        objInfo.Solution = astrometryTracker.AstrometricFit;
                        objInfo.Pixel = e.Pixel;
                        objInfo.Gaussian = e.Gausian;
                        if (m_AstrometricState.IdentifiedObjects != null)
                            objInfo.IdentifiedObject = m_AstrometricState.GetIdentifiedObjectAt(objInfo.RADeg, objInfo.DEDeg);
                        else
                            objInfo.IdentifiedObject = null;

                        // We don't want to reload the current frame as this will result in trying another Astrometric Fit
                        // So we send a message to the Astrometry component about the newly selected object
                        m_AstrometryController.NewObjectSelected(objInfo);

                        m_SelectedObject = objInfo;
                        m_VideoController.RedrawCurrentFrame(false);
                    }
                }
            }
        }