1 /*  Ekos GuideView
2     Child of FITSView with few additions necessary for Internal Guider
3 
4     SPDX-FileCopyrightText: 2020 Hy Murveit <hy@murveit.com>
5 
6     SPDX-License-Identifier: GPL-2.0-or-later
7 */
8 
9 #pragma once
10 
11 #include "fitsviewer/fitsview.h"
12 
13 #include <QList>
14 
15 class QPainter;
16 
17 /**
18  * The main change relative to fitsview is to add the capability of displaying
19  * the 'neighbor guide stars' for the SEP Multi Star guide algorithm.
20  */
21 class GuideView : public FITSView
22 {
23         Q_OBJECT
24     public:
25         explicit GuideView(QWidget *parent = nullptr, FITSMode mode = FITS_NORMAL, FITSScale filter = FITS_NONE);
26 
27         // Calls the parent drawOverlay, then draws circles around the guide-star
28         // neighbors and lines between the guide star and the neighbors.
29         void drawOverlay(QPainter *, double scale) override;
30 
31         // Adds a neighbor at x,y. Set found to true if the neighbor was associated
32         // with a detected star. Coordinates of the detected star are optional.
33         void addGuideStarNeighbor(double targetX, double targetY, bool found,
34                                   double detectedX = 0, double detectedY = 0,
35                                   bool isGuideStar = false);
36 
37         // Remove all the neighbors.
38         void clearNeighbors();
39 
40     protected:
41 
42     private:
43         struct Neighbor
44         {
45             // x and y input-image coordinates for the guide star neighbor target position.
46             double targetX;
47             double targetY;
48 
49             // Was the neighbor at the above location was associated with a detected star.
50             bool found;
51 
52             // x and y input-image coordinates for the guide star neighbor that was detected.
53             double detectedX;
54             double detectedY;
55 
56             bool isGuideStar;
57         };
58 
59         void drawNeighbor(QPainter *painter, const Neighbor &neighbor);
60         QList<Neighbor> neighbors;
61     signals:
62 };
63