Ejemplo n.º 1
0
 public virtual void MouseClick(ObjectClickEventArgs e)
 {
 }
Ejemplo n.º 2
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);
                        }
                    }
                }
                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);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public override void MouseClick(ObjectClickEventArgs e)
        {
            if (m_OperationState == SpectroscopyState.ChoosingStar && e.Gausian != null && e.Gausian.IsSolved && e.Gausian.Certainty > 0.2)
            {
                float bestAngle = m_SpectroscopyController.LocateSpectraAngle(e.Gausian);

                if (float.IsNaN(bestAngle))
                {
                    SelectedStar = new ImagePixel(e.Gausian.XCenter, e.Gausian.YCenter);
                    SelectedStarFWHM = e.Gausian.FWHM;
                    m_SelectedStarGaussian = e.Gausian;
                    MeasurementAreaWing = (int)(2 * Math.Ceiling(SelectedStarFWHM));
                    BackgroundAreaWing = MeasurementAreaWing;
                    BackgroundAreaGap = 5;

                    SelectedAnglePoint = Point.Empty;
                    m_ControlPanel.ClearSpectra();

                    m_OperationState = SpectroscopyState.ChoosingAngleManually;
                }
                else
                {
                    SelectedStar = new ImagePixel(e.Gausian.XCenter, e.Gausian.YCenter);
                    SelectedStarFWHM = e.Gausian.FWHM;
                    m_SelectedStarGaussian = e.Gausian;
                    MeasurementAreaWing = (int)(2 * Math.Ceiling(SelectedStarFWHM));
                    BackgroundAreaWing = MeasurementAreaWing;
                    BackgroundAreaGap = 5;

                    SetBestAngle(bestAngle);
                }

                m_VideoController.RedrawCurrentFrame(false, true);
            }
            else if (m_OperationState == SpectroscopyState.ChoosingAngleManually && SelectedStar != null)
            {
                double atanAgnle = 180 * Math.Atan((SelectedStar.YDouble - e.Pixel.YDouble)/(e.Pixel.XDouble - SelectedStar.XDouble)) / Math.PI;
                if (atanAgnle < 0) atanAgnle = 360 + atanAgnle;
                int roughAngle = (int) atanAgnle;
                float bestAngle = m_SpectroscopyController.LocateSpectraAngle(e.Gausian, roughAngle);
                if (!float.IsNaN(bestAngle))
                {
                    SetBestAngle(bestAngle);
                    m_VideoController.RedrawCurrentFrame(false, true);
                }
            }
        }
Ejemplo n.º 4
0
        public override void MouseClick(ObjectClickEventArgs e)
        {
            if (e.Pixel != null &&
                m_StateMachine.CurrentState < LightCurvesState.ReadyToRun)
            {
                // Keep track on the currently selected object in the state
                if (e.Gausian != null && e.Gausian.IsSolved)
                    m_StateMachine.SelectedObject = new ImagePixel(e.Gausian.Brightness, e.Gausian.XCenter, e.Gausian.YCenter);
                else
                {
                    m_StateMachine.SelectedObject = e.Pixel;
                }

                m_StateMachine.SelectedObjectGaussian = e.Gausian;
                m_StateMachine.SelectedObjectFrameNo = m_CurrFrameNo;

                int existingIndexId = -1;
                if (!m_StateMachine.IsNewObject(e.Pixel, e.Shift, e.Control, ref existingIndexId))
                {
                    m_StateMachine.SelectedMeasuringStar = existingIndexId;
                }
                else
                    m_StateMachine.SelectedMeasuringStar = -1;

                SelectedTargetChanged(m_StateMachine.SelectedMeasuringStar);

                // This is how we tell the VideoOperation that something changed.
                m_VideoController.RefreshCurrentFrame();
            }
        }
Ejemplo n.º 5
0
 public override void MouseClick(ObjectClickEventArgs e)
 {
 }
Ejemplo n.º 6
0
 public virtual void MouseClick(ObjectClickEventArgs e)
 {
 }
Ejemplo n.º 7
0
        public override void MouseClick(ObjectClickEventArgs e)
        {
            if (m_State == FittingsState.Configuring)
                m_OSDExcluderTool.MouseClick(e);
            if (m_State == FittingsState.Solved)
            {
                IStarMap starMap = AstrometryContext.Current.StarMap;
                if (starMap != null)
                {
                    int x, y;
                    StarMapFeature feature = starMap.GetFeatureInRadius(e.Pixel.X, e.Pixel.Y, 5);
                    if (feature != null)
                    {
                        x = feature.GetCenter().X;
                        y = feature.GetCenter().Y;
                    }
                    else
                    {
                        x = e.Pixel.X;
                        y = e.Pixel.Y;
                    }

                    int searchArea = Control.ModifierKeys == Keys.Shift ? 5 : 10;

                    PSFFit psfFit;
                    ImagePixel pixelCent = starMap.GetPSFFit(x, y, searchArea, out psfFit);
                    if (pixelCent != null && pixelCent != ImagePixel.Unspecified)
                    {
                        PlateConstStarPair selectedPair = null;
                        LeastSquareFittedAstrometry astrometry = FittedAstrometryFromUserSelectedFitGrade();
                        if (astrometry != null)
                        {
                            foreach (PlateConstStarPair pair in astrometry.FitInfo.AllStarPairs)
                            {
                                if (Math.Abs(pair.x - pixelCent.X) < 2 &&
                                    Math.Abs(pair.y - pixelCent.Y) < 2)
                                {
                                    selectedPair = pair;
                                    break;
                                }
                            }
                        }

                        DrawHighResFeature(pixelCent, selectedPair, astrometry);
                    }
                    else
                        ClearZoomImage();
                }
            }
        }