Warning, file /education/kstars/kstars/fitsviewer/fitsviewer.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2004 Jasem Mutlaq <mutlaqja@ikarustech.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 
0006     Some code fragments were adapted from Peter Kirchgessner's FITS plugin
0007     SPDX-FileCopyrightText: Peter Kirchgessner <http://members.aol.com/pkirchg>
0008 */
0009 
0010 #pragma once
0011 
0012 #include "fitscommon.h"
0013 
0014 #include <KLed>
0015 #include <KXmlGui/KXmlGuiWindow>
0016 #include <KActionMenu>
0017 
0018 #include <QLabel>
0019 #include <QList>
0020 #include <QMap>
0021 #include <QUrl>
0022 
0023 #ifdef WIN32
0024 // avoid compiler warning when windows.h is included after fitsio.h
0025 #include <windows.h>
0026 #endif
0027 
0028 #include <fitsio.h>
0029 
0030 class QCloseEvent;
0031 class QUndoGroup;
0032 
0033 class QTabWidget;
0034 
0035 class FITSDebayer;
0036 class FITSTab;
0037 class FITSView;
0038 class FITSData;
0039 
0040 /**
0041  * @class FITSViewer
0042  * @short Primary window to view monochrome and color FITS images.
0043  * The FITSviewer can open multiple images each in a separate. It supports simple filters, histogram transforms, flip and rotation operations, and star detection.
0044  *
0045  * @author Jasem Mutlaq
0046  * @version 1.0
0047  */
0048 class FITSViewer : public KXmlGuiWindow
0049 {
0050         Q_OBJECT
0051 
0052     public:
0053         /** Constructor. */
0054         explicit FITSViewer(QWidget *parent);
0055         ~FITSViewer() override;
0056 
0057         void loadFile(const QUrl &imageName, FITSMode mode = FITS_NORMAL, FITSScale filter = FITS_NONE,
0058                       const QString &previewText = QString());
0059 
0060         bool loadData(const QSharedPointer<FITSData> &data, const QUrl &imageName, int *tab_uid,
0061                       FITSMode mode = FITS_NORMAL, FITSScale filter = FITS_NONE,
0062                       const QString &previewText = QString());
0063 
0064         void updateFile(const QUrl &imageName, int fitsUID, FITSScale filter = FITS_NONE);
0065         bool updateData(const QSharedPointer<FITSData> &data, const QUrl &imageName, int fitsUID, int *tab_uid,
0066                         FITSScale filter = FITS_NONE, FITSMode mode = FITS_UNKNOWN);
0067         bool removeFITS(int fitsUID);
0068 
0069         bool isStarsMarked()
0070         {
0071             return markStars;
0072         }
0073 
0074         bool empty() const
0075         {
0076             return fitsTabs.empty();
0077         }
0078         QList<FITSTab *> getTabs()
0079         {
0080             return fitsTabs;
0081         }
0082         bool getView(int fitsUID, QSharedPointer<FITSView> &view);
0083         bool getCurrentView(QSharedPointer<FITSView> &view);
0084 
0085         static QStringList filterTypes;
0086 
0087     protected:
0088         void closeEvent(QCloseEvent *) override;
0089         void hideEvent(QHideEvent *) override;
0090         void showEvent(QShowEvent *) override;
0091 
0092     public slots:
0093         void changeAlwaysOnTop(Qt::ApplicationState state);
0094         void openFile();
0095         void saveFile();
0096         void saveFileAs();
0097         void copyFITS();
0098         void statFITS();
0099         void toggleSelectionMode();
0100         void headerFITS();
0101         void debayerFITS();
0102         void histoFITS();
0103         void tabFocusUpdated(int currentIndex);
0104         void updateStatusBar(const QString &msg, FITSBar id);
0105         void ZoomIn();
0106         void ZoomOut();
0107         void ZoomDefault();
0108         void ZoomToFit();
0109         void updateAction(const QString &name, bool enable);
0110         void updateTabStatus(bool clean, const QUrl &imageURL);
0111         void closeTab(int index);
0112         void toggleStars();
0113         void toggleCrossHair();
0114         void toggleClipping();
0115         void toggleEQGrid();
0116         void toggleObjects();
0117         void togglePixelGrid();
0118         void toggle3DGraph();
0119         void starProfileButtonOff();
0120         void centerTelescope();
0121         void updateWCSFunctions();
0122         void applyFilter(int ftype);
0123         void rotateCW();
0124         void rotateCCW();
0125         void flipHorizontal();
0126         void flipVertical();
0127         void setDebayerAction(bool);
0128         void updateScopeButton();
0129         void ROIFixedSize(int s);
0130         void customROIInputWindow();
0131 
0132 
0133     private:
0134         void updateButtonStatus(const QString &action, const QString &item, bool showing);
0135         // Shared utilites between the standard and "FromData" addFITS and updateFITS.
0136         bool addFITSCommon(FITSTab *tab, const QUrl &imageName,
0137                            FITSMode mode, const QString &previewText);
0138         bool updateFITSCommon(FITSTab *tab, const QUrl &imageName);
0139 
0140         QTabWidget *fitsTabWidget { nullptr };
0141         QUndoGroup *undoGroup { nullptr };
0142         FITSDebayer *debayerDialog { nullptr };
0143         KLed led;
0144         QLabel fitsPosition, fitsValue, fitsResolution, fitsZoom, fitsWCS, fitsHFR, fitsClip;
0145         QAction *saveFileAction { nullptr };
0146         QAction *saveFileAsAction { nullptr };
0147         QList<FITSTab *> fitsTabs;
0148         int fitsID { 0 };
0149         bool markStars { false };
0150         QMap<int, FITSTab *> fitsMap;
0151         QUrl lastURL;
0152         KActionMenu *roiActionMenu { nullptr };
0153         KActionMenu* roiMenu { nullptr };
0154 
0155     signals:
0156         void trackingStarSelected(int x, int y);
0157         void loaded(int tabUID);
0158         void closed(int tabUID);
0159         void failed(const QString &errorMessage);
0160 };