File indexing completed on 2024-04-28 15:09:53

0001 /*  Ekos GuideView
0002     Child of FITSView with few additions necessary for Internal Guider
0003 
0004     SPDX-FileCopyrightText: 2020 Hy Murveit <hy@murveit.com>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include "fitsviewer/fitsview.h"
0012 
0013 #include <QList>
0014 
0015 class QPainter;
0016 
0017 /**
0018  * The main change relative to fitsview is to add the capability of displaying
0019  * the 'neighbor guide stars' for the SEP Multi Star guide algorithm.
0020  */
0021 class GuideView : public FITSView
0022 {
0023         Q_OBJECT
0024     public:
0025         explicit GuideView(QWidget *parent = nullptr, FITSMode mode = FITS_NORMAL, FITSScale filter = FITS_NONE);
0026 
0027         // Calls the parent drawOverlay, then draws circles around the guide-star
0028         // neighbors and lines between the guide star and the neighbors.
0029         void drawOverlay(QPainter *, double scale) override;
0030 
0031         // Adds a neighbor at x,y. Set found to true if the neighbor was associated
0032         // with a detected star. Coordinates of the detected star are optional.
0033         void addGuideStarNeighbor(double targetX, double targetY, bool found,
0034                                   double detectedX = 0, double detectedY = 0,
0035                                   bool isGuideStar = false);
0036 
0037         // Remove all the neighbors.
0038         void clearNeighbors();
0039 
0040         // Refresh the neighbor graphics if necessary.
0041         void updateNeighbors();
0042 
0043     protected:
0044 
0045     private:
0046         struct Neighbor
0047         {
0048             // x and y input-image coordinates for the guide star neighbor target position.
0049             double targetX;
0050             double targetY;
0051 
0052             // Was the neighbor at the above location was associated with a detected star.
0053             bool found;
0054 
0055             // x and y input-image coordinates for the guide star neighbor that was detected.
0056             double detectedX;
0057             double detectedY;
0058 
0059             bool isGuideStar;
0060         };
0061 
0062         void drawNeighbor(QPainter *painter, const Neighbor &neighbor);
0063         QList<Neighbor> neighbors;
0064 
0065         // True if neighbors have been added but not yet displayed.
0066         bool newNeighbors { false };
0067     signals:
0068 };