Changeset View
Changeset View
Standalone View
Standalone View
kstars/fitsviewer/fitsview.h
1 | /* FITS Label | 1 | /* FITS Label | ||
---|---|---|---|---|---|
2 | Copyright (C) 2003-2017 Jasem Mutlaq <mutlaqja@ikarustech.com> | 2 | Copyright (C) 2003-2017 Jasem Mutlaq <mutlaqja@ikarustech.com> | ||
3 | Copyright (C) 2016-2017 Robert Lancaster <rlancaste@gmail.com> | 3 | Copyright (C) 2016-2017 Robert Lancaster <rlancaste@gmail.com> | ||
4 | 4 | | |||
5 | This application is free software; you can redistribute it and/or | 5 | This application is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU General Public | 6 | modify it under the terms of the GNU General Public | ||
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either | ||
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. | ||
9 | */ | 9 | */ | ||
10 | 10 | | |||
11 | #pragma once | 11 | #pragma once | ||
12 | 12 | | |||
13 | #include "fitscommon.h" | 13 | #include "fitscommon.h" | ||
14 | 14 | | |||
15 | #include <config-kstars.h> | 15 | #include <config-kstars.h> | ||
16 | #include "stretch.h" | ||||
16 | 17 | | |||
17 | #ifdef HAVE_DATAVISUALIZATION | 18 | #ifdef HAVE_DATAVISUALIZATION | ||
18 | #include "starprofileviewer.h" | 19 | #include "starprofileviewer.h" | ||
19 | #endif | 20 | #endif | ||
20 | 21 | | |||
21 | #include <QFutureWatcher> | 22 | #include <QFutureWatcher> | ||
22 | #include <QPixmap> | 23 | #include <QPixmap> | ||
23 | #include <QScrollArea> | 24 | #include <QScrollArea> | ||
▲ Show 20 Lines • Show All 174 Lines • ▼ Show 20 Line(s) | 55 | public: | |||
198 | { | 199 | { | ||
199 | return showStarProfile; | 200 | return showStarProfile; | ||
200 | } | 201 | } | ||
201 | // Floating toolbar | 202 | // Floating toolbar | ||
202 | void createFloatingToolBar(); | 203 | void createFloatingToolBar(); | ||
203 | 204 | | |||
204 | //void setLoadWCSEnabled(bool value); | 205 | //void setLoadWCSEnabled(bool value); | ||
205 | 206 | | |||
207 | // Returns the params set to stretch the image. | ||||
208 | StretchParams getStretchParams() const { return stretchParams; } | ||||
209 | | ||||
210 | // Returns true if we're automatically generating stretch parameters. | ||||
211 | // Note: this is not whether we're stretching, that's controlled by stretchImage. | ||||
212 | bool getAutoStretch() const { return autoStretch; } | ||||
213 | | ||||
214 | // Sets the params for stretching. Will also stretch and re-display the image. | ||||
215 | // This only sets the first channel stretch params. For RGB images, the G&B channel | ||||
216 | // stretch parameters are a function of the Red input param and the existing RGB params. | ||||
217 | void setStretchParams(const StretchParams& params); | ||||
218 | | ||||
219 | // Sets whether to stretch the image or not. | ||||
220 | // Will also re-display the image if onOff != stretchImage. | ||||
221 | void setStretch(bool onOff); | ||||
222 | | ||||
223 | // Automatically generates stretch parameters and use them to re-display the image. | ||||
224 | void setAutoStretchParams(); | ||||
225 | | ||||
226 | // When sampling is > 1, we will display the image at a lower resolution. | ||||
227 | void setSampling(int value) { if (value > 0) sampling = value; } | ||||
228 | | ||||
206 | public slots: | 229 | public slots: | ||
207 | void wheelEvent(QWheelEvent *event) override; | 230 | void wheelEvent(QWheelEvent *event) override; | ||
208 | void resizeEvent(QResizeEvent *event) override; | 231 | void resizeEvent(QResizeEvent *event) override; | ||
209 | void ZoomIn(); | 232 | void ZoomIn(); | ||
210 | void ZoomOut(); | 233 | void ZoomOut(); | ||
211 | void ZoomDefault(); | 234 | void ZoomDefault(); | ||
212 | void ZoomToFit(); | 235 | void ZoomToFit(); | ||
213 | 236 | | |||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 267 | protected: | |||
263 | QPointF markerCrosshair; | 286 | QPointF markerCrosshair; | ||
264 | /// Pointer to FITSData object | 287 | /// Pointer to FITSData object | ||
265 | FITSData *imageData { nullptr }; | 288 | FITSData *imageData { nullptr }; | ||
266 | /// Current zoom level | 289 | /// Current zoom level | ||
267 | double currentZoom { 0 }; | 290 | double currentZoom { 0 }; | ||
268 | 291 | | |||
269 | private: | 292 | private: | ||
270 | bool processData(); | 293 | bool processData(); | ||
294 | void doStretch(FITSData *data, QImage *outputImage); | ||||
271 | 295 | | |||
272 | QLabel *noImageLabel { nullptr }; | 296 | QLabel *noImageLabel { nullptr }; | ||
273 | QPixmap noImage; | 297 | QPixmap noImage; | ||
274 | 298 | | |||
275 | QVector<QPointF> eqGridPoints; | 299 | QVector<QPointF> eqGridPoints; | ||
276 | 300 | | |||
277 | std::unique_ptr<FITSLabel> image_frame; | 301 | std::unique_ptr<FITSLabel> image_frame; | ||
278 | 302 | | |||
279 | uint32_t image_width { 0 }; | | |||
280 | uint32_t image_height { 0 }; | | |||
281 | | ||||
282 | /// Current width due to zoom | 303 | /// Current width due to zoom | ||
283 | uint16_t currentWidth { 0 }; | 304 | uint16_t currentWidth { 0 }; | ||
284 | uint16_t lastWidth { 0 }; | 305 | uint16_t lastWidth { 0 }; | ||
285 | /// Current height due to zoom | 306 | /// Current height due to zoom | ||
286 | uint16_t currentHeight { 0 }; | 307 | uint16_t currentHeight { 0 }; | ||
287 | uint16_t lastHeight { 0 }; | 308 | uint16_t lastHeight { 0 }; | ||
288 | /// Image zoom factor | 309 | /// Image zoom factor | ||
289 | const double zoomFactor; | 310 | const double zoomFactor; | ||
Show All 9 Lines | |||||
299 | bool markStars { false }; | 320 | bool markStars { false }; | ||
300 | bool showStarProfile { false }; | 321 | bool showStarProfile { false }; | ||
301 | bool showCrosshair { false }; | 322 | bool showCrosshair { false }; | ||
302 | bool showObjects { false }; | 323 | bool showObjects { false }; | ||
303 | bool showEQGrid { false }; | 324 | bool showEQGrid { false }; | ||
304 | bool showPixelGrid { false }; | 325 | bool showPixelGrid { false }; | ||
305 | bool showStarsHFR { false }; | 326 | bool showStarsHFR { false }; | ||
306 | 327 | | |||
328 | // Should the image be displayed in linear (false) or stretched (true). | ||||
329 | // Initial value controlled by Options::autoStretch. | ||||
307 | bool stretchImage { false }; | 330 | bool stretchImage { false }; | ||
308 | 331 | | |||
332 | // When stretching, should we automatically compute parameters. | ||||
333 | // When first displaying, this should be true, but may be set to false | ||||
334 | // if the user has overridden the automatically set parameters. | ||||
335 | bool autoStretch { true }; | ||||
336 | | ||||
337 | // Params for stretching image. | ||||
338 | StretchParams stretchParams; | ||||
339 | | ||||
340 | // Resolution for display. Sampling=2 means display every other sample. | ||||
341 | int sampling { 1 }; | ||||
342 | | ||||
309 | struct | 343 | struct | ||
310 | { | 344 | { | ||
311 | bool used() const | 345 | bool used() const | ||
312 | { | 346 | { | ||
313 | return innerRadius != 0.0f || outerRadius != 1.0f; | 347 | return innerRadius != 0.0f || outerRadius != 1.0f; | ||
314 | } | 348 | } | ||
315 | float innerRadius { 0.0f }; | 349 | float innerRadius { 0.0f }; | ||
316 | float outerRadius { 1.0f }; | 350 | float outerRadius { 1.0f }; | ||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |