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 void loadFile(const QUrl &imageName, FITSMode mode = FITS_NORMAL, FITSScale filter = FITS_NONE,
59 const QString &previewText = QString());
60
61 bool loadData(const QSharedPointer<FITSData> &data, const QUrl &imageName, int *tab_uid,
62 FITSMode mode = FITS_NORMAL, FITSScale filter = FITS_NONE,
63 const QString &previewText = QString());
64
65 void updateFile(const QUrl &imageName, int fitsUID, FITSScale filter = FITS_NONE);
66 bool updateData(const QSharedPointer<FITSData> &data, const QUrl &imageName, int fitsUID, int *tab_uid,
67 FITSScale filter = FITS_NONE, FITSMode mode = FITS_UNKNOWN);
68 bool removeFITS(int fitsUID);
69
70 bool isStarsMarked()
71 {
72 return markStars;
73 }
74
75 bool empty() const
76 {
77 return m_Tabs.empty();
78 }
79 const QList<QSharedPointer<FITSTab>> tabs() const
80 {
81 return m_Tabs;
82 }
83 bool getView(int fitsUID, QSharedPointer<FITSView> &view);
84 bool getCurrentView(QSharedPointer<FITSView> &view);
85
86 static QStringList filterTypes;
87
88 protected:
89 void closeEvent(QCloseEvent *) override;
90 void hideEvent(QHideEvent *) override;
91 void showEvent(QShowEvent *) override;
92
93 public slots:
94 void changeAlwaysOnTop(Qt::ApplicationState state);
95 void openFile();
96 void blink();
97 void nextBlink();
98 void previousBlink();
99 void saveFile();
100 void saveFileAs();
101 void copyFITS();
102 void statFITS();
103 void toggleSelectionMode();
104 void headerFITS();
105 void debayerFITS();
106 void histoFITS();
107 void tabFocusUpdated(int currentIndex);
108 void updateStatusBar(const QString &msg, FITSBar id);
109 void ZoomIn();
110 void ZoomOut();
111 void ZoomAllIn();
112 void ZoomAllOut();
113 void ZoomDefault();
114 void ZoomToFit();
115 void updateAction(const QString &name, bool enable);
116 void updateTabStatus(bool clean, const QUrl &imageURL);
117 void closeTab(int index);
118 void toggleStars();
119 void nextTab();
120 void previousTab();
121 void toggleCrossHair();
122 void toggleClipping();
123 void toggleEQGrid();
124 void toggleObjects();
125 void togglePixelGrid();
126 void toggle3DGraph();
127 void toggleHiPSOverlay();
128 void starProfileButtonOff();
129 void centerTelescope();
130 void updateWCSFunctions();
131 void applyFilter(int ftype);
132 void rotateCW();
133 void rotateCCW();
134 void flipHorizontal();
135 void flipVertical();
136 void setDebayerAction(bool);
137 void updateScopeButton();
138 void ROIFixedSize(int s);
139 void customROIInputWindow();
140
141
142 private:
143 void updateButtonStatus(const QString &action, const QString &item, bool showing);
144 // Shared utilites between the standard and "FromData" addFITS and updateFITS.
145 bool addFITSCommon(const QSharedPointer<FITSTab> &tab, const QUrl &imageName,
146 FITSMode mode, const QString &previewText);
147 bool updateFITSCommon(const QSharedPointer<FITSTab> &tab, const QUrl &imageName);
148
149 QTabWidget *fitsTabWidget { nullptr };
150 QUndoGroup *undoGroup { nullptr };
151 FITSDebayer *debayerDialog { nullptr };
152 KLed led;
153 QLabel fitsPosition, fitsValue, fitsResolution, fitsZoom, fitsWCS, fitsHFR, fitsClip;
154 QAction *saveFileAction { nullptr };
155 QAction *saveFileAsAction { nullptr };
157 int fitsID { 0 };
158 bool markStars { false };
160 QUrl lastURL;
161 KActionMenu *roiActionMenu { nullptr };
162 KActionMenu* roiMenu { nullptr };
163
164 void loadFiles();
165 QList<QUrl> m_urls;
166 void changeBlink(bool increment);
167 static bool m_BlinkBusy;
168
169 signals:
170 void trackingStarSelected(int x, int y);
171 void loaded(int tabUID);
172 void closed(int tabUID);
173 void failed(const QString &errorMessage);
174 void terminated();
175
176};
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 Tue Mar 26 2024 11:19:03 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.