Kstars

fitsviewer.h
1/*
2 SPDX-FileCopyrightText: 2004 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5
6 Some code fragments were adapted from Peter Kirchgessner's FITS plugin
7 SPDX-FileCopyrightText: Peter Kirchgessner <http://members.aol.com/pkirchg>
8*/
9
10#pragma once
11
12#include "fitscommon.h"
13#include "fitsviewer/stretch.h"
14
15#include <KLed>
16#include <KXmlGui/KXmlGuiWindow>
17#include <KActionMenu>
18
19#include <QLabel>
20#include <QList>
21#include <QMap>
22#include <QUrl>
23
24#ifdef WIN32
25// avoid compiler warning when windows.h is included after fitsio.h
26#include <windows.h>
27#endif
28
29#include <fitsio.h>
30
31class QCloseEvent;
32class QUndoGroup;
33
34class QTabWidget;
35
36class FITSDebayer;
37class FITSTab;
38class FITSView;
39class FITSData;
40
41/**
42 * @class FITSViewer
43 * @short Primary window to view monochrome and color FITS images.
44 * The FITSviewer can open multiple images each in a separate. It supports simple filters, histogram transforms, flip and rotation operations, and star detection.
45 *
46 * @author Jasem Mutlaq
47 * @version 1.0
48 */
50{
52
53 public:
54 /** Constructor. */
55 explicit FITSViewer(QWidget *parent);
56 ~FITSViewer() override;
57
58 // Returns the tab id for the tab to be loaded (could be used in updateFile/Data).
59 // It may be that the id is not used if the load fails.
60 int loadFile(const QUrl &imageName, FITSMode mode = FITS_NORMAL, FITSScale filter = FITS_NONE,
61 const QString &previewText = QString());
62
63 bool loadData(const QSharedPointer<FITSData> &data, const QUrl &imageName, int *tab_uid,
64 FITSMode mode = FITS_NORMAL, FITSScale filter = FITS_NONE,
65 const QString &previewText = QString());
66
67 void updateFile(const QUrl &imageName, int fitsUID, FITSScale filter = FITS_NONE);
68 bool updateData(const QSharedPointer<FITSData> &data, const QUrl &imageName, int fitsUID, int *tab_uid,
69 FITSMode mode = FITS_UNKNOWN, FITSScale filter = FITS_NONE, const QString &tabTitle = QString());
70 bool removeFITS(int fitsUID);
71
72 bool isStarsMarked()
73 {
74 return markStars;
75 }
76
77 bool empty() const
78 {
79 return m_Tabs.empty();
80 }
81 const QList<QSharedPointer<FITSTab>> tabs() const
82 {
83 return m_Tabs;
84 }
85 bool getView(int fitsUID, QSharedPointer<FITSView> &view);
86 bool getCurrentView(QSharedPointer<FITSView> &view);
87
88 // Checks if the tab is in the fitsMap;
89 bool tabExists(int tab_uid);
90
91 static QList<KLocalizedString> filterTypes;
92
93 protected:
94 void closeEvent(QCloseEvent *) override;
95 void hideEvent(QHideEvent *) override;
96 void showEvent(QShowEvent *) override;
97
98 public slots:
99 void changeAlwaysOnTop(Qt::ApplicationState state);
100 void openFile();
101 void blink();
102 void nextBlink();
103 void previousBlink();
104 void saveFile();
105 void saveFileAs();
106 void copyFITS();
107 void statFITS();
108 void toggleSelectionMode();
109 void headerFITS();
110 void debayerFITS();
111 void histoFITS();
112 void tabFocusUpdated(int currentIndex);
113 void updateStatusBar(const QString &msg, FITSBar id);
114 void ZoomIn();
115 void ZoomOut();
116 void ZoomAllIn();
117 void ZoomAllOut();
118 void ZoomDefault();
119 void ZoomToFit();
120 void FitToZoom();
121 void updateAction(const QString &name, bool enable);
122 void updateTabStatus(bool clean, const QUrl &imageURL);
123 void closeTab(int index);
124 void toggleStars();
125 void nextTab();
126 void previousTab();
127 void toggleCrossHair();
128 void toggleClipping();
129 void toggleEQGrid();
130 void toggleObjects();
131 void togglePixelGrid();
132 void toggle3DGraph();
133 void toggleHiPSOverlay();
134 void starProfileButtonOff();
135 void centerTelescope();
136 void updateWCSFunctions();
137 void applyFilter(int ftype);
138 void rotateCW();
139 void rotateCCW();
140 void flipHorizontal();
141 void flipVertical();
142 void setDebayerAction(bool);
143 void updateScopeButton();
144 void ROIFixedSize(int s);
145 void customROIInputWindow();
146
147
148 private:
149 void updateButtonStatus(const QString &action, const QString &item, bool showing);
150 // Shared utilites between the standard and "FromData" addFITS and updateFITS.
151 bool addFITSCommon(const QSharedPointer<FITSTab> &tab, const QUrl &imageName,
152 FITSMode mode, const QString &previewText);
153 bool updateFITSCommon(const QSharedPointer<FITSTab> &tab, const QUrl &imageName, const QString tabTitle = "");
154
155 QTabWidget *fitsTabWidget { nullptr };
156 QUndoGroup *undoGroup { nullptr };
157 FITSDebayer *debayerDialog { nullptr };
158 KLed led;
159 QLabel fitsPosition, fitsValue, fitsResolution, fitsZoom, fitsWCS, fitsHFR, fitsClip;
160 QAction *saveFileAction { nullptr };
161 QAction *saveFileAsAction { nullptr };
163 int fitsID { 0 };
164 bool markStars { false };
166 QUrl lastURL;
167 KActionMenu *roiActionMenu { nullptr };
168 KActionMenu* roiMenu { nullptr };
169
170 void loadFiles();
171 QList<QUrl> m_urls;
172 void changeBlink(bool increment);
173 static bool m_BlinkBusy;
174
175 signals:
176 void trackingStarSelected(int x, int y);
177 void loaded(int tabUID);
178 void closed(int tabUID);
179 void failed(const QString &errorMessage);
180 void terminated();
181
182};
The FITSTab class holds information on the current view (drawing area) in addition to the undo/redo s...
Definition fitstab.h:46
Primary window to view monochrome and color FITS images.
Definition fitsviewer.h:50
FITSViewer(QWidget *parent)
Constructor.
void centerTelescope()
This method either enables or disables the scope mouse mode so you can slew your scope to coordinates...
void updateWCSFunctions()
This is a method that either enables or disables the WCS based features in the Current View.
virtual QAction * action(const QDomElement &element) const
bool empty() const const
Q_OBJECTQ_OBJECT
QObject * parent() const const
ApplicationState
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:59:52 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.