Exemple #1
0
 public void Update(ImageTool imageTool)
 {
     if (imageTool != null &&
         m_VideoController != null)
     {
         m_VideoController.DisplayCursorPositionDetails(new Point(imageTool.MouseX, imageTool.MouseY));
     }
 }
Exemple #2
0
        public override void MouseMove(Point location)
        {
            IStarMap map = AstrometryContext.Current.StarMap;

            if (map == null)
            {
                return;
            }

            bool nearbyStarFound = false;

            AstrometricState state = AstrometryContext.Current.AstrometricState;

            if (state != null)
            {
                if (state.AstrometricFit != null)
                {
                    for (int radius = 1; radius < 8; radius++)
                    {
                        ImagePixel centroid = map.GetCentroid(location.X, location.Y, radius);
                        if (centroid == null)
                        {
                            continue;
                        }


                        foreach (PlateConstStarPair star in state.AstrometricFit.FitInfo.AllStarPairs)
                        {
                            if (Math.Abs(star.x - centroid.XDouble) < radius &&
                                Math.Abs(star.y - centroid.YDouble) < radius)
                            {
                                m_Object = star;

                                nearbyStarFound = true;
                                break;
                            }
                        }

                        if (nearbyStarFound)
                        {
                            break;
                        }
                    }

                    if (!nearbyStarFound)
                    {
                        m_State = SelectObjectState.NoObject;
                    }
                    else
                    {
                        m_State = SelectObjectState.ObjectLocked;
                    }


                    if (m_AstrometricState.MeasuringState == AstrometryInFramesState.Ready)
                    {
                        double ra, de;
                        state.AstrometricFit.GetRADEFromImageCoords(location.X, location.Y, out ra, out de);

                        string moreInfo = string.Format("RA={0} DE={1}", AstroConvert.ToStringValue(ra / 15, "HHhMMmSS.Ts"), AstroConvert.ToStringValue(de, "+DD°MM'SS\""));
                        m_VideoController.DisplayCursorPositionDetails(location, moreInfo);
                    }
                }
                else
                {
                    StarMapFeature nearbyFeature = map.GetFeatureInRadius(location.X, location.Y, 8);
                    nearbyStarFound = nearbyFeature != null && nearbyFeature.PixelCount > 4;
                }

                m_VideoController.SetPictureBoxCursor(nearbyStarFound ? Cursors.Hand : (state.ManualStarIdentificationMode ? Cursors.Cross : Cursors.Default));
            }
        }
Exemple #3
0
        public override void MouseMove(Point location)
        {
            bool dirty = false;

            int posX = location.X < 16
                                                   ? 16
                                                   : (location.X > TangraContext.Current.FrameWidth - 17
                                                                  ? TangraContext.Current.FrameWidth - 17
                                                                  : location.X);
            int posY = location.Y < 16
                                                   ? 16
                                                   : (location.Y > TangraContext.Current.FrameHeight - 17
                                                                  ? TangraContext.Current.FrameHeight - 17
                                                                  : location.Y);

            m_VideoController.DisplayCursorPositionDetails(location);

            m_SelectedCalibrationStar = null;

            if (!m_Panning)
            {
                if (m_Is3StarIdMode)
                {
                    StarMapFeature closestFeature = AstrometryContext.Current.StarMap.GetFeatureInRadius(posX, posY, 2);
                    if (closestFeature != null)
                    {
                        if (m_Is3StarIdMode)
                        {
                            m_VideoController.SetPictureBoxCursor(Cursors.Hand);
                            PSFFit psfFit;
                            AstrometryContext.Current.StarMap.GetPSFFit(posX, posY, 13, out psfFit);
                            m_SelectedCalibrationStar = psfFit;
                        }
                    }
                    else
                    {
                        m_VideoController.SetPictureBoxCursor(Cursors.Arrow);
                    }
                }
                else
                {
                    m_VideoController.SetPictureBoxCursor(CustomCursors.PanCursor);
                }
            }
            else if (m_Panning &&
                     m_StarPoint != Point.Empty)
            {
                ResetPreviousStar();

                if (m_SolvedPlate != null)
                {
                    double raDeg1, deDeg1, raDeg2, deDeg2;
                    m_SolvedPlate.GetRADEFromImageCoords(location.X, location.Y, out raDeg1, out deDeg1);
                    m_SolvedPlate.GetRADEFromImageCoords(m_StarPoint.X, m_StarPoint.Y, out raDeg2, out deDeg2);

                    double ra = m_RADegCenter + (raDeg2 - raDeg1);
                    double de = m_DEDegCenter + (deDeg2 - deDeg1);

                    if (m_SolvedPlate is LeastSquareFittedAstrometry)
                    {
                        m_SolvedPlate = new LeastSquareFittedAstrometry(m_Image, ra, de, null /*m_SolvePlateConts*/);
                    }
                    else if (m_SolvedPlate is TangentalTransRotAstrometry)
                    {
                        m_SolvedPlate = new TangentalTransRotAstrometry(m_SolvedPlate as TangentalTransRotAstrometry, m_Image, ra, de, m_Eta);
                    }
                    else
                    {
                        m_SolvedPlate = new DirectTransRotAstrometry(m_Image, ra, de, m_Eta, m_Aspect);
                    }
                }

                dirty = true;
            }

            if (dirty)
            {
                DrawCatalogStarsFit();
            }
        }