10#include "fitscommon.h"
11#include "auxiliary/imagemask.h"
13#include <config-kstars.h>
16#ifdef HAVE_DATAVISUALIZATION
17#include "starprofileviewer.h"
20#include <QFutureWatcher>
54 explicit FITSView(
QWidget *
parent =
nullptr, FITSMode
fitsMode = FITS_NORMAL, FITSScale filterType = FITS_NONE);
55 virtual ~FITSView()
override;
57 typedef enum {dragCursor, selectCursor, scopeCursor, crosshairCursor } CursorMode;
81 bool rescale(FITSZoom type);
88 double getCurrentZoom()
const
92 const QImage &getDisplayImage()
const
96 const QPixmap &getDisplayPixmap()
const
102 void setTrackingBoxEnabled(
bool enable);
103 bool isTrackingBoxEnabled()
const
105 return trackingBoxEnabled;
107 QPixmap &getTrackingBoxPixmap(uint8_t margin = 0);
109 const QRect &getTrackingBox()
const
115 const QString &lastError()
const
121 virtual void drawOverlay(
QPainter *,
double scale);
125 void drawStarCentroid(
QPainter *,
double scale);
127 void drawTrackingBox(
QPainter *,
double scale);
128 void drawMarker(
QPainter *,
double scale);
129 void drawCrosshair(
QPainter *,
double scale);
131#if !defined(KSTARS_LITE) && defined(HAVE_WCSLIB)
135 void drawObjectNames(
QPainter *painter,
double scale);
136 void drawPixelGrid(
QPainter *painter,
double scale);
137 void drawMagnifyingGlass(
QPainter *painter,
double scale);
139 bool isImageStretched();
140 bool isCrosshairShown();
141 bool isClippingShown();
142 bool areObjectsShown();
143 bool isEQGridShown();
144 bool isSelectionRectShown();
145 bool isPixelGridShown();
146 bool isHiPSOverlayShown();
150 void updateFrame(
bool now =
false);
153 bool isTelescopeActive();
154 void updateScopeButton();
155 void setScopeButton(
QAction *action)
157 centerTelescopeAction = action;
161 void enterEvent(
QEvent *event)
override;
162 void leaveEvent(
QEvent *event)
override;
163 CursorMode getCursorMode();
164 void setCursorMode(CursorMode mode);
165 void updateMouseCursor();
170 uint16_t zoomedWidth()
174 uint16_t zoomedHeight()
176 return currentHeight;
178 double ZoomFactor()
const
185 void toggleStars(
bool enable);
187 void setStarsEnabled(
bool enable);
188 void setStarsHFREnabled(
bool enable);
193 void setImageMask(ImageMask *
mask);
196 void updateMode(FITSMode
fmode);
202 void setFilter(FITSScale newFilter)
207 void setFirstLoad(
bool value);
209 void pushFilter(FITSScale value)
211 filterStack.
push(value);
213 FITSScale popFilter()
215 return filterStack.
pop();
218 CursorMode lastMouseMode { selectCursor };
219 bool isStarProfileShown()
221 return showStarProfile;
224 void createFloatingToolBar();
229 StretchParams getStretchParams()
const
231 return stretchParams;
236 bool getAutoStretch()
const
244 void setStretchParams(
const StretchParams ¶ms);
248 void setStretch(
bool onOff);
251 void setAutoStretchParams();
255 void setPreviewSampling(uint8_t value)
259 m_PreviewSampling = m_AdaptiveSampling;
260 m_StretchingInProgress =
false;
264 m_PreviewSampling = value * m_AdaptiveSampling;
265 m_StretchingInProgress =
true;
275 QRect getSelectionRegion()
const
277 return selectionRectangleRaw;
287 void updateMagnifyingGlass(
int x,
int y);
291 void toggleObjects();
292 void togglePixelGrid();
293 void toggleCrosshair();
296 void toggleHiPSOverlay();
299 void toggleSelectionMode();
303 void toggleStarProfile();
304 void viewStarProfile();
306 void centerTelescope();
308 void toggleStretch();
309 void toggleClipping();
311 virtual void processPointSelection(
int x,
int y);
312 virtual void processMarkerSelection(
int x,
int y);
314 void move3DTrackingBox(
int x,
int y);
315 void resizeTrackingBox(
int newSize);
317 void processRectangleFixed(
int s);
325 bool event(
QEvent *event)
override;
332 void calculateMaxPixel(
double min,
double max);
333 void initDisplayImage();
336 bool pointIsInImage(
QPointF pt,
double scale);
343 QRect selectionRectangleRaw;
345 QToolBar *floatingToolBar {
nullptr };
355 double currentZoom { 0 };
360 uint8_t *m_ImageRoiBuffer {
nullptr };
362 uint32_t m_ImageRoiBufferSize { 0 };
367 double scaleSize(
double size);
369 bool initDisplayPixmap(
QImage &image,
float space);
370 void updateFrameLargeImage();
371 void updateFrameSmallImage();
380 uint16_t currentWidth { 0 };
382 uint16_t currentHeight { 0 };
384 const double m_ZoomFactor;
391 bool firstLoad {
true };
392 bool markStars {
false };
393 bool showStarProfile {
false };
394 bool showCrosshair {
false };
395 bool showObjects {
false };
396 bool showEQGrid {
false };
397 bool showPixelGrid {
false };
398 bool showHiPSOverlay {
false };
399 bool showStarsHFR {
false };
400 bool showClipping {
false };
402 int m_NumClipped { 0 };
404 bool showSelectionRect {
false };
408 bool stretchImage {
false };
413 bool autoStretch {
true };
416 StretchParams stretchParams;
419 uint8_t m_PreviewSampling { 1 };
420 bool m_StretchingInProgress {
false};
422 uint8_t m_AdaptiveSampling {1};
427 CursorMode cursorMode { selectCursor };
428 bool zooming {
false };
436 QTimer m_UpdateFrameTimer;
441 bool trackingBoxEnabled {
false };
451 QAction *centerTelescopeAction {
nullptr };
452 QAction *toggleEQGridAction {
nullptr };
453 QAction *toggleObjectsAction {
nullptr };
454 QAction *toggleStarsAction {
nullptr };
455 QAction *toggleProfileAction {
nullptr };
456 QAction *toggleStretchAction {
nullptr };
457 QAction *toggleHiPSOverlayAction {
nullptr };
460 int magnifyingGlassX { -1 };
461 int magnifyingGlassY { -1 };
462 bool showMagnifyingGlass {
false };
463 bool m_Suspended {
false};
466 bool m_QueueUpdate {
false};
471#ifdef HAVE_DATAVISUALIZATION
476 void newStatus(
const QString &msg, FITSBar
id);
477 void newStretch(
const StretchParams ¶ms);
478 void debayerToggled(
bool);
479 void wcsToggled(
bool);
480 void actionUpdated(
const QString &name,
bool enable);
481 void trackingStarSelected(
int x,
int y);
484 void failed(
const QString &error);
485 void starProfileWindowClosed();
488 void showRubberBand(
bool on =
false);
489 void zoomRubberBand(
double scale);
490 void mouseOverPixel(
int x,
int y);
492 friend class FITSLabel;
QObject * parent() const const