Kstars

imageoverlaycomponent.h
1/*
2 SPDX-FileCopyrightText: 2023 Hy Murveit <hy@murveit.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "imageoverlaycomponent.h"
10#include "skycomponent.h"
11#include <QSharedPointer>
12#include <QImage>
13#include <QObject>
14#include <QLabel>
15#include <QTimer>
16#include <QPushButton>
17#include <QPlainTextEdit>
18#include <QGroupBox>
19#include <QComboBox>
20#include <QAbstractItemView>
21#include "fitsviewer/fitsdata.h"
22
23class QTableWidget;
24class SolverUtils;
25
26class ImageOverlay
27{
28 public:
29 enum Status
30 {
31 UNPROCESSED = 0,
32 BAD_FILE,
33 PLATE_SOLVE_FAILURE,
34 OTHER_ERROR,
35 AVAILABLE,
36 NUM_STATUS
37 };
38
39 ImageOverlay(const QString &filename = "", bool enabled = true, const QString &nickname = "",
40 Status status = UNPROCESSED, double orientation = 0, double ra = 0, double dec = 0,
41 double pixelsPerArcsec = 0, bool eastToTheRight = true, int width = 0, int height = 0)
42 : m_Filename(filename), m_Enabled(enabled), m_Nickname(nickname), m_Status(status),
43 m_Orientation(orientation), m_RA(ra), m_DEC(dec), m_ArcsecPerPixel(pixelsPerArcsec),
44 m_EastToTheRight(eastToTheRight), m_Width(width), m_Height(height)
45 {
46 }
47
48 QString m_Filename;
49 bool m_Enabled = true;
50 QString m_Nickname;
51 Status m_Status = UNPROCESSED;
52 double m_Orientation = 0.0;
53 double m_RA = 0.0;
54 double m_DEC = 0.0;
55 double m_ArcsecPerPixel = 0.0;
56 bool m_EastToTheRight = true;
57 int m_Width = 0;
58 int m_Height = 0;
59 QSharedPointer<QImage> m_Img = nullptr;
60};
61
62/**
63 * @class ImageOverlayComponent
64 * Represents the ImageOverlay overlay
65 * @author Hy Murveit
66 * @version 1.0
67 */
69{
71
72 public:
74
75 virtual ~ImageOverlayComponent() override;
76
77 bool selected() override;
78 void draw(SkyPainter *skyp) override;
79 void setWidgets(QTableWidget *table, QPlainTextEdit *statusDisplay, QPushButton *solveButton,
80 QGroupBox *tableTitleBox, QComboBox *solverProfile);
81 void updateTable();
82
83 const QList<ImageOverlay> imageOverlays() const {
84 return m_Overlays;
85 }
86
87 public slots:
88 void startSolving();
89 void abortSolving();
90 void show();
91 void reload(); // not currently implemented.
92 QString directory()
93 {
94 return m_Directory;
95 };
96
97 signals:
98 void updateLog(const QString &message);
99
100private slots:
101 void tryAgain();
102 void updateStatusDisplay(const QString &message);
103
104private:
105 void loadFromUserDB();
106 void saveToUserDB();
107 void solveImage(const QString &filename);
108 void solverDone(bool timedOut, bool success, const FITSImage::Solution &solution, double elapsedSeconds);
109 void initializeGui();
110 int numAvailable();
111 void cellChanged(int row, int col);
112 void statusCellChanged(int row);
113 void selectionChanged();
114 void initSolverProfiles();
115
116 // Methods that load the image files in the background.
117 void loadAllImageFiles();
118 void loadImageFileLoop();
119 bool loadImageFile();
120 QImage *loadImageFile (const QString &fullFilename, bool mirror);
121
122
123 QTableWidget *m_ImageOverlayTable;
124 QGroupBox *m_TableGroupBox;
125 QAbstractItemView::EditTriggers m_EditTriggers;
126 QPlainTextEdit *m_StatusDisplay;
127 QPushButton *m_SolveButton;
128 QComboBox *m_SolverProfile;
129 QStringList m_LogText;
130 bool m_Initialized = false;
131
132 QList<ImageOverlay> m_Overlays;
133 QMap<QString, int> m_Filenames;
135 QList<int> m_RowsToSolve;
136 QString m_Directory;
137 QTimer m_TryAgainTimer;
138 QFuture<void> m_LoadImagesFuture;
139};
Represents the ImageOverlay overlay.
void draw(SkyPainter *skyp) override
Draw the object on the SkyMap skyp a pointer to the SkyPainter to use.
SkyComponent represents an object on the sky map.
SkyComposite is a kind of container class for SkyComponent objects.
Draws things on the sky, without regard to backend.
Definition skypainter.h:40
NETWORKMANAGERQT_EXPORT NetworkManager::Status status()
Q_OBJECTQ_OBJECT
QTextStream & dec(QTextStream &stream)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.