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

KDE's Doxygen guidelines are available online.