Kstars

skymap.h
1/*
2 SPDX-FileCopyrightText: 2001 Jason Harris <jharris@30doradus.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "config-kstars.h"
10
11#include "skymapdrawabstract.h"
12#include "printing/legend.h"
13#include "skyobjects/skypoint.h"
14#include "skyobjects/skyline.h"
15#include "nan.h"
16
17#include <QGraphicsView>
18#include <QtGlobal>
19#include <QTimer>
20
21class QPainter;
22class QPaintDevice;
23
24class dms;
25class InfoBoxes;
26class InfoBoxWidget;
27class KSPopupMenu;
28class KStarsData;
29class Projector;
30class SkyObject;
31
32#ifdef HAVE_OPENGL
33class SkyMapGLDraw;
34class SkyMapQDraw;
35#endif
36
37/**
38 * @class SkyMap
39 *
40 * This is the canvas on which the sky is painted. It's the main widget for KStars.
41 * Contains SkyPoint members for the map's Focus (current central position), Destination
42 * (requested central position), FocusPoint (next queued position to be focused),
43 * MousePoint (position of mouse cursor), and ClickedPoint (position of last mouse click).
44 * Also contains the InfoBoxes for on-screen data display.
45 *
46 * SkyMap handles most user interaction events (both mouse and keyboard).
47 *
48 * @short Canvas widget for displaying the sky bitmap; also handles user interaction events.
49 *
50 * @author Jason Harris
51 * @version 1.0
52 */
53class SkyMap : public QGraphicsView
54{
56
57 friend class SkyMapDrawAbstract; // FIXME: SkyMapDrawAbstract requires a lot of access to SkyMap
58 friend class SkyMapQDraw; // FIXME: SkyMapQDraw requires access to computeSkymap
59
60 protected:
61 /**
62 *Constructor. Read stored settings from KConfig object (focus position,
63 *zoom factor, sky color, etc.). Run initPopupMenus().
64 */
65 SkyMap();
66
67 public:
68 static SkyMap *Create();
69
70 static SkyMap *Instance();
71
72 static bool IsFocused()
73 {
74 //return (pinstance->focusObject() || pinstance->focusPoint());
75 return (pinstance->focusObject());
76 }
77
78 static bool IsSlewing()
79 {
80 return pinstance->isSlewing();
81 }
82
83 /** Destructor (empty) */
84 ~SkyMap() override;
85
86 enum Projection
87 {
88 Lambert,
89 AzimuthalEquidistant,
90 Orthographic,
91 Equirectangular,
92 Stereographic,
93 Gnomonic,
94 UnknownProjection
95 };
96
97 enum Cursor
98 {
99 NoCursor,
100 Cross,
101 Circle,
102 };
103
104 /** @return the angular field of view of the sky map, in degrees.
105 *@note it must use either the height or the width of the window to calculate the
106 *FOV angle. It chooses whichever is larger.
107 */
108 float fov();
109
110 /** @short Update object name and coordinates in the Focus InfoBox */
111 void showFocusCoords();
112
113 /** @brief Update info boxes coordinates */
114 void updateInfoBoxes();
115
116 /** @short Update the focus position according to current options. */
117 void updateFocus();
118
119 /** @short Retrieve the Focus point; the position on the sky at the
120 *center of the skymap.
121 *@return a pointer to the central focus point of the sky map
122 */
124 {
125 return &Focus;
126 }
127
128 /** @short retrieve the Destination position.
129 *
130 *The Destination is the point on the sky to which the focus will
131 *be moved.
132 *
133 *@return a pointer to the destination point of the sky map
134 */
136 {
137 return &Destination;
138 }
139
140 /** @short retrieve the FocusPoint position.
141 *
142 *The FocusPoint stores the position on the sky that is to be
143 *focused next. This is not exactly the same as the Destination
144 *point, because when the Destination is set, it will begin slewing
145 *immediately.
146 *
147 *@return a pointer to the sky point which is to be focused next.
148 */
150 {
151 return &FocusPoint;
152 }
153
154 /** @short sets the central focus point of the sky map.
155 *@param f a pointer to the SkyPoint the map should be centered on
156 */
157 void setFocus(SkyPoint *f);
158
159 /** @short sets the focus point of the skymap, using ra/dec coordinates
160 *
161 *@note This function behaves essentially like the above function.
162 *It differs only in the data types of its arguments.
163 *
164 *@param ra the new right ascension
165 *@param dec the new declination
166 */
167 void setFocus(const dms &ra, const dms &dec);
168
169 /** @short sets the focus point of the sky map, using its alt/az coordinates
170 *@param alt the new altitude (actual, without refraction correction)
171 *@param az the new azimuth
172 */
173 void setFocusAltAz(const dms &alt, const dms &az);
174
175 /** @short sets the destination point of the sky map.
176 *@note setDestination() emits the destinationChanged() SIGNAL,
177 *which triggers the SLOT function SkyMap::slewFocus(). This
178 *function iteratively steps the Focus point toward Destination,
179 *repainting the sky at each step (if Options::useAnimatedSlewing()==true).
180 *@param f a pointer to the SkyPoint the map should slew to
181 */
182 void setDestination(const SkyPoint &f);
183
184 /** @short sets the destination point of the skymap, using ra/dec coordinates.
185 *
186 *@note This function behaves essentially like the above function.
187 *It differs only in the data types of its arguments.
188 *
189 *@param ra the new right ascension
190 *@param dec the new declination
191 */
192 void setDestination(const dms &ra, const dms &dec);
193
194 /** @short sets the destination point of the sky map, using its alt/az coordinates.
195 *@param alt the new altitude
196 *@param az the new azimuth
197 *@param altIsRefracted set to true if the altitude supplied is apparent
198 */
199 void setDestinationAltAz(const dms &alt, const dms &az, bool altIsRefracted);
200
201 /** @short set the FocusPoint; the position that is to be the next Destination.
202 *@param f a pointer to the FocusPoint SkyPoint.
203 */
205 {
206 if (f)
207 FocusPoint = *f;
208 }
209
210 /** @short Retrieve the ClickedPoint position.
211 *
212 *When the user clicks on a point in the sky map, the sky coordinates of the mouse
213 *cursor are stored in the private member ClickedPoint. This function retrieves
214 *a pointer to ClickedPoint.
215 *@return a pointer to ClickedPoint, the sky coordinates where the user clicked.
216 */
218 {
219 return &ClickedPoint;
220 }
221
222 /**
223 * @short Retrieve the mouse pointer position.
224 *
225 * @return The sky coordinates where the mouse pointer is over.
226 */
228 {
229 return &m_MousePoint;
230 }
231
232 /** @short Set the ClickedPoint to the skypoint given as an argument.
233 *@param f pointer to the new ClickedPoint.
234 */
235 void setClickedPoint(const SkyPoint *f);
236
237 /** @short Retrieve the object nearest to a mouse click event.
238 *
239 *If the user clicks on the sky map, a pointer to the nearest SkyObject is stored in
240 *the private member ClickedObject. This function returns the ClickedObject pointer,
241 *or nullptr if there is no CLickedObject.
242 *@return a pointer to the object nearest to a user mouse click.
243 */
245 {
246 return ClickedObject;
247 }
248
249 /** @short Set the ClickedObject pointer to the argument.
250 *@param o pointer to the SkyObject to be assigned as the ClickedObject
251 */
253
254 /** @short Retrieve the object which is centered in the sky map.
255 *
256 *If the user centers the sky map on an object (by double-clicking or using the
257 *Find Object dialog), a pointer to the "focused" object is stored in
258 *the private member FocusObject. This function returns a pointer to the
259 *FocusObject, or nullptr if there is not FocusObject.
260 *@return a pointer to the object at the center of the sky map.
261 */
263 {
264 return FocusObject;
265 }
266
267 /** @short Set the FocusObject pointer to the argument.
268 *@param o pointer to the SkyObject to be assigned as the FocusObject
269 */
270 void setFocusObject(SkyObject *o);
271
272 /** @short Call to set up the projector before a draw cycle. */
273 void setupProjector();
274
275 /** @ Set zoom factor.
276 *@param factor zoom factor
277 */
278 void setZoomFactor(double factor);
279
280 bool isSlewing() const;
281
282 // NOTE: This method is draw-backend independent.
283 /** @short update the geometry of the angle ruler. */
284 void updateAngleRuler();
285
286 /** @return true if the object currently has a user label attached.
287 *@note this function only checks for a label explicitly added to the object
288 *with the right-click popup menu; other kinds of labels are not detected by
289 *this function.
290 *@param o pointer to the sky object to be tested for a User label.
291 */
292 bool isObjectLabeled(SkyObject *o);
293
294 /*@*@short Convenience function for shutting off tracking mode. Just calls KStars::slotTrack().
295 */
296 void stopTracking();
297
298 /** Get the current projector.
299 @return a pointer to the current projector. */
300 inline const Projector *projector() const
301 {
302 return m_proj;
303 }
304
305 // NOTE: These dynamic casts must not segfault. If they do, it's good because we know that there is a problem.
306 /**
307 *@short Proxy method for SkyMapDrawAbstract::exportSkyImage()
308 */
309 inline void exportSkyImage(QPaintDevice *pd, bool scale = false)
310 {
311 dynamic_cast<SkyMapDrawAbstract *>(m_SkyMapDraw)->exportSkyImage(pd, scale);
312 }
313
314 inline void exportSkyImage(SkyQPainter *painter, bool scale = false)
315 {
316 dynamic_cast<SkyMapDrawAbstract *>(m_SkyMapDraw)->exportSkyImage(painter, scale);
317 }
318
319 SkyMapDrawAbstract *getSkyMapDrawAbstract()
320 {
321 return dynamic_cast<SkyMapDrawAbstract *>(m_SkyMapDraw);
322 }
323
324 /**
325 *@short Proxy method for SkyMapDrawAbstract::drawObjectLabels()
326 */
327 inline void drawObjectLabels(QList<SkyObject *> &labelObjects)
328 {
329 dynamic_cast<SkyMapDrawAbstract *>(m_SkyMapDraw)->drawObjectLabels(labelObjects);
330 }
331
332 void setPreviewLegend(bool preview)
333 {
334 m_previewLegend = preview;
335 }
336
337 void setLegend(const Legend &legend)
338 {
339 m_legend = legend;
340 }
341
342 bool isInObjectPointingMode() const
343 {
344 return m_objPointingMode;
345 }
346
347 void setObjectPointingMode(bool enabled)
348 {
349 m_objPointingMode = enabled;
350 }
351
352 void setFovCaptureMode(bool enabled)
353 {
354 m_fovCaptureMode = enabled;
355 }
356
357 bool isInFovCaptureMode() const
358 {
359 return m_fovCaptureMode;
360 }
361
362 /** @short Sets the shape of the default mouse cursor. */
363 void setMouseCursorShape(Cursor type);
364
365 SkyPoint getCenterPoint();
366
367 public slots:
368 /** Recalculates the positions of objects in the sky, and then repaints the sky map.
369 * If the positions don't need to be recalculated, use update() instead of forceUpdate().
370 * This saves a lot of CPU time.
371 * @param now if true, paintEvent() is run immediately. Otherwise, it is added to the event queue
372 */
373 void forceUpdate(bool now = false);
374
375 /** @short Convenience function; simply calls forceUpdate(true).
376 * @see forceUpdate()
377 */
379 {
380 forceUpdate(true);
381 }
382
383 /**
384 * @short Update the focus point and call forceUpdate()
385 * @param now is passed on to forceUpdate()
386 */
387 void slotUpdateSky(bool now);
388
389 /** Toggle visibility of geo infobox */
390 void slotToggleGeoBox(bool);
391
392 /** Toggle visibility of focus infobox */
393 void slotToggleFocusBox(bool);
394
395 /** Toggle visibility of time infobox */
396 void slotToggleTimeBox(bool);
397
398 /** Toggle visibility of all infoboxes */
399 void slotToggleInfoboxes(bool);
400
401 /** Sets the base sky rotation (before correction) to the given angle */
402 void slotSetSkyRotation(double angle);
403
404 /** Step the Focus point toward the Destination point. Do this iteratively, redrawing the Sky
405 * Map after each step, until the Focus point is within 1 step of the Destination point.
406 * For the final step, snap directly to Destination, and redraw the map.
407 */
408 void slewFocus();
409
410 /** @short Center the display at the point ClickedPoint.
411 *
412 * The essential part of the function is to simply set the Destination point, which will emit
413 * the destinationChanged() SIGNAL, which triggers the slewFocus() SLOT. Additionally, this
414 * function performs some bookkeeping tasks, such updating whether we are tracking the new
415 * object/position, adding a Planet Trail if required, etc.
416 *
417 * @see destinationChanged()
418 * @see slewFocus()
419 */
420 void slotCenter();
421
422 /** @short Popup menu function: Display 1st-Generation DSS image with the Image Viewer.
423 * @note the URL is generated using the coordinates of ClickedPoint.
424 */
425 void slotDSS();
426
427 /** @short Popup menu function: Display Sloan Digital Sky Survey image with the Image Viewer.
428 * @note the URL is generated using the coordinates of ClickedPoint.
429 */
430 void slotSDSS();
431
432 /**
433 * @brief slotCopyCoordinates Copies J2000 and JNow equatorial coordinates to the clipboard in addition to horizontal coords.
434 */
435 void slotCopyCoordinates();
436
437 /**
438 * @brief slotCopyTLE Copy satellite TLE to clipboard.
439 */
440 void slotCopyTLE();
441
442 /** @short Popup menu function: Show webpage about ClickedObject
443 * (only available for some objects).
444 */
445 void slotInfo();
446
447 /** @short Popup menu function: Show image of ClickedObject
448 * (only available for some objects).
449 */
450 void slotImage();
451
452 /** @short Popup menu function: Show the Detailed Information window for ClickedObject. */
453 void slotDetail();
454
455 /** Add ClickedObject to KStarsData::ObjLabelList, which stores pointers to SkyObjects which
456 * have User Labels attached.
457 */
458 void slotAddObjectLabel();
459
460 /** Remove ClickedObject from KStarsData::ObjLabelList, which stores pointers to SkyObjects which
461 * have User Labels attached.
462 */
464
465 /** Remove custom object from internet search in the local catalog */
467
468 /** @short Add a Planet Trail to ClickedObject.
469 * @note Trails are added simply by calling KSPlanetBase::addToTrail() to add the first point.
470 * as long as the trail is not empty, new points will be automatically appended to it.
471 * @note if ClickedObject is not a Solar System body, this function does nothing.
472 * @see KSPlanetBase::addToTrail()
473 */
474 void slotAddPlanetTrail();
475
476 /** @short Remove the PlanetTrail from ClickedObject.
477 * @note The Trail is removed by simply calling KSPlanetBase::clearTrail(). As long as
478 * the trail is empty, no new points will be automatically appended.
479 * @see KSPlanetBase::clearTrail()
480 */
482
483 /** @short Render a fading text label on the screen to flash information */
484 void slotDisplayFadingText(const QString &text);
485
486 /** Checks whether the timestep exceeds a threshold value. If so, sets
487 * ClockSlewing=true and sets the SimClock to ManualMode.
488 */
489 void slotClockSlewing();
490
491 /** Enables the angular distance measuring mode. It saves the first
492 * position of the ruler in a SkyPoint. It makes difference between
493 * having clicked on the skymap and not having done so
494 * \note This method is draw-backend independent.
495 */
497
498 void slotBeginStarHop(); // TODO: Add docs
499
500 /** Computes the angular distance, prints the result in the status
501 * bar and disables the angular distance measuring mode
502 * If the user has clicked on the map the status bar shows the
503 * name of the clicked object plus the angular distance. If
504 * the user did not clicked on the map, just pressed ], only
505 * the angular distance is printed
506 * \note This method is draw-backend independent.
507 */
508 void slotEndRulerMode();
509
510 /** Disables the angular distance measuring mode. Nothing is printed
511 * in the status bar */
512 void slotCancelRulerMode();
513
514 /** @short Open Flag Manager window with clickedObject() RA and Dec entered.
515 */
516 void slotAddFlag();
517
518 /** @short Open Flag Manager window with RA and Dec entered.
519 */
520 void slotAddFlagRaw();
521
522 /** @short Open Flag Manager window with selected flag focused and ready to edit.
523 *@param flagIdx index of flag to be edited.
524 */
525 void slotEditFlag(int flagIdx);
526
527 /** @short Delete selected flag.
528 *@param flagIdx index of flag to be deleted.
529 */
530 void slotDeleteFlag(int flagIdx);
531
532#ifdef HAVE_OPENGL
533 void slotToggleGL();
534#endif
535
536 /** Run Xplanet Viewer to display images of the planets*/
538
539 /** Zoom in one step. */
540 void slotZoomIn();
541
542 /** Zoom out one step. */
543 void slotZoomOut();
544
545 /** Set default zoom. */
546 void slotZoomDefault();
547
548 /** Object pointing for Printing Wizard done */
549 void slotObjectSelected();
550
551 void slotCancelLegendPreviewMode();
552
553 void slotFinishFovCaptureMode();
554
555 void slotCaptureFov();
556
557 signals:
558 /** Emitted by setDestination(), and connected to slewFocus(). Whenever the Destination
559 * point is changed, slewFocus() will iteratively step the Focus toward Destination
560 * until it is reached.
561 * @see SkyMap::setDestination()
562 * @see SkyMap::slewFocus()
563 */
565
566 /** Emitted when zoom level is changed. */
568
569 /** Emitted when current object changed. */
571
572 /** Emitted when pointing changed. (At least should) */
574
575 /** Emitted when position under mouse changed. */
577
578 /** Emitted when a position is clicked */
580
581 /** Emitted when a position is clicked */
583
584 /** Emitted when a sky object is removed from the database */
586
587 /** Emitter when mosaic center is dragged in the sky map */
589
590 void updateQueued();
591
592 protected:
593 bool event(QEvent *event) override;
594
595 /** Process keystrokes:
596 * @li arrow keys Slew the map
597 * @li +/- keys Zoom in and out
598 * @li <i>Space</i> Toggle between Horizontal and Equatorial coordinate systems
599 * @li 0-9 Go to a major Solar System body (0=Sun; 1-9 are the major planets, except 3=Moon)
600 * @li [ Place starting point for measuring an angular distance
601 * @li ] End point for Angular Distance; display measurement.
602 * @li <i>Escape</i> Cancel Angular measurement
603 * @li ,/< Step backward one time step
604 * @li ./> Step forward one time step
605 */
606 void keyPressEvent(QKeyEvent *e) override;
607
608 /** When keyRelease is triggered, just set the "slewing" flag to false,
609 * and update the display (to draw objects that are hidden when slewing==true). */
610 void keyReleaseEvent(QKeyEvent *e) override;
611
612 /** Determine RA, Dec coordinates of clicked location. Find the SkyObject
613 * which is nearest to the clicked location.
614 *
615 * If left-clicked: Set set mouseButtonDown==true, slewing==true; display
616 * nearest object name in status bar.
617 * If right-clicked: display popup menu appropriate for nearest object.
618 */
619 void mousePressEvent(QMouseEvent *e) override;
620
621 /** set mouseButtonDown==false, slewing==false */
622 void mouseReleaseEvent(QMouseEvent *e) override;
623
624 /** Center SkyMap at double-clicked location */
625 void mouseDoubleClickEvent(QMouseEvent *e) override;
626
627 /** This function does several different things depending on the state of the program:
628 * @li If Angle-measurement mode is active, update the end-ruler point to the mouse cursor,
629 * and continue this function.
630 * @li If we are defining a ZoomBox, update the ZoomBox rectangle, redraw the screen,
631 * and return.
632 * @li If dragging the mouse in the map, update focus such that RA, Dec under the mouse
633 * cursor remains constant.
634 * @li If just moving the mouse, simply update the curso coordinates in the status bar.
635 */
636 void mouseMoveEvent(QMouseEvent *e) override;
637
638 /** Zoom in and out with the mouse wheel. */
639 void wheelEvent(QWheelEvent *e) override;
640
641 /** If the skymap will be resized, the sky must be new computed. So this
642 * function calls explicitly new computing of the skymap.
643 */
644 void resizeEvent(QResizeEvent *) override;
645
646 private slots:
647 /** @short display tooltip for object under cursor. It's called by m_HoverTimer.
648 * if mouse didn't moved for last HOVER_INTERVAL milliseconds.
649 */
650 void slotTransientLabel();
651
652 /** Set the shape of mouse cursor to a cross with 4 arrows. */
653 void setMouseMoveCursor();
654
655 /** Set the shape of mouse cursor to an open hand. */
656 void setMouseDragCursor();
657
658 private:
659
660 /** @short Sets the shape of the mouse cursor to a magnifying glass. */
661 void setZoomMouseCursor();
662
663 /** @short Sets the shape of the mouse cursor to a rotation symbol. */
664 void setRotationMouseCursor();
665
666 /** Calculate the zoom factor for the given keyboard modifier
667 */
668 double zoomFactor(const int modifier);
669
670 /** calculate the magnitude factor (1, .5, .2, or .1) for the given
671 * keyboard modifier.
672 */
673 double magFactor(const int modifier);
674
675 /** Decrease the magnitude limit by a step size determined by the
676 * keyboard modifier.
677 * @param modifier
678 */
679 void decMagLimit(const int modifier);
680
681 /** Increase the magnitude limit by a step size determined by the
682 * keyboard modifier.
683 * @param modifier
684 */
685 void incMagLimit(const int modifier);
686
687 /** Convenience routine to either zoom in or increase mag limit
688 * depending on the Alt modifier. The Shift and Control modifiers
689 * will adjust the size of the zoom or the mag step.
690 * @param modifier
691 */
692 void zoomInOrMagStep(const int modifier);
693
694 /** Convenience routine to either zoom out or decrease mag limit
695 * depending on the Alt modifier. The Shift and Control modifiers
696 * will adjust the size of the zoom or the mag step.
697 * @param modifier
698 */
699 void zoomOutOrMagStep(const int modifier);
700
701 void beginRulerMode(bool starHopRuler); // TODO: Add docs
702
703 /**
704 * Determine the rotation angle of the SkyMap
705 *
706 * This is simply Options::skyRotation() if the erect observer
707 * correction is not applicable, but otherwise it is
708 * determined by adding a correction amount dependent on the
709 * focus of the sky map
710 */
711 dms determineSkyRotation();
712
713 /**
714 * @short Strart xplanet.
715 * @param outputFile Output file path.
716 */
717 void startXplanet(const QString &outputFile = "");
718
719 bool mouseButtonDown { false };
720 bool midMouseButtonDown { false };
721 /// True if mouseMoveEvent; needed by setMouseMoveCursor
722 bool mouseMoveCursor { false };
723 bool mouseDragCursor { false };
724 bool slewing { false };
725 bool clockSlewing { false };
726 //if false only old pixmap will repainted with bitBlt(), this
727 // saves a lot of cpu usage
728 bool computeSkymap { false };
729 // True if we are either looking for angular distance or star hopping directions
730 bool rulerMode { false };
731 // True only if we are looking for star hopping directions. If
732 // false while rulerMode is true, it means we are measuring angular
733 // distance. FIXME: Find a better way to do this
734 bool starHopDefineMode { false };
735 double y0;
736
737 QPoint rotationStart;
738 dms rotationStartAngle;
739
740 double m_Scale;
741
742 KStarsData *data { nullptr };
743 KSPopupMenu *pmenu { nullptr };
744
745 /// Coordinates of point under cursor. It's update in function mouseMoveEvent
746 SkyPoint m_MousePoint;
747
748 // A copy of m_MousePoint, copied when the mouse is pressed.
749 SkyPoint m_MousePointPressed;
750
751 SkyPoint Focus, ClickedPoint, FocusPoint, Destination;
752 SkyObject *ClickedObject { nullptr };
753 SkyObject *FocusObject { nullptr };
754
755 Projector *m_proj { nullptr };
756
757 SkyLine AngularRuler; //The line for measuring angles in the map
758 QRect ZoomRect; //The manual-focus circle.
759
760 // Mouse should not move for that interval to display tooltip
761 static const int HOVER_INTERVAL = 500;
762 // Timer for tooltips
763 QTimer m_HoverTimer;
764
765 // InfoBoxes. Used in destructor to save state
766 InfoBoxWidget *m_timeBox { nullptr };
767 InfoBoxWidget *m_geoBox { nullptr };
768 InfoBoxWidget *m_objBox { nullptr };
769 InfoBoxes *m_iboxes { nullptr };
770
771 // legend
772 bool m_previewLegend { false };
773 Legend m_legend;
774
775 bool m_objPointingMode { false };
776 bool m_fovCaptureMode { false };
777 bool m_touchMode { false };
778 bool m_pinchMode { false };
779 bool m_tapAndHoldMode { false };
780 qreal m_pinchScale { 0.0 };
781
782 QWidget *m_SkyMapDraw { nullptr }; // Can be dynamic_cast<> to SkyMapDrawAbstract
783
784 // NOTE: These are pointers to the individual widgets
785#ifdef HAVE_OPENGL
786 SkyMapQDraw *m_SkyMapQDraw { nullptr };
787 SkyMapGLDraw *m_SkyMapGLDraw { nullptr };
788#endif
789
790 static SkyMap *pinstance;
791 /// Good to keep the original ruler start-point for purposes of dynamic_cast
792 const SkyPoint *m_rulerStartPoint { nullptr };
793};
The InfoBoxWidget class is a widget that displays a transparent box for display of text messages.
The InfoBoxes class is a collection of InfoBoxWidget objects that display a transparent box for displ...
The KStars Popup Menu.
Definition kspopupmenu.h:35
KStarsData is the backbone of KStars.
Definition kstarsdata.h:74
The Projector class is the primary class that serves as an interface to handle projections.
Definition projector.h:58
A series of connected line segments in the sky, composed of SkyPoints at its vertices.
Definition skyline.h:27
This class defines the methods that both rendering engines (GLPainter and QPainter) must implement.
This class draws the SkyMap using OpenGL.
This class draws the SkyMap using native QPainter.
Definition skymapqdraw.h:22
This is the canvas on which the sky is painted.
Definition skymap.h:54
SkyPoint * focusPoint()
retrieve the FocusPoint position.
Definition skymap.h:149
void mouseReleaseEvent(QMouseEvent *e) override
set mouseButtonDown==false, slewing==false
void showFocusCoords()
Update object name and coordinates in the Focus InfoBox.
Definition skymap.cpp:327
void setZoomFactor(double factor)
@ Set zoom factor.
Definition skymap.cpp:1176
void zoomChanged()
Emitted when zoom level is changed.
void setMouseCursorShape(Cursor type)
Sets the shape of the default mouse cursor.
Definition skymap.cpp:1318
void slotToggleTimeBox(bool)
Toggle visibility of time infobox.
Definition skymap.cpp:268
SkyPoint * focus()
Retrieve the Focus point; the position on the sky at the center of the skymap.
Definition skymap.h:123
void slotSDSS()
Popup menu function: Display Sloan Digital Sky Survey image with the Image Viewer.
Definition skymap.cpp:563
void setupProjector()
Call to set up the projector before a draw cycle.
Definition skymap.cpp:1255
void slotObjectSelected()
Object pointing for Printing Wizard done.
Definition skymap.cpp:920
float fov()
Definition skymap.cpp:1206
void keyReleaseEvent(QKeyEvent *e) override
When keyRelease is triggered, just set the "slewing" flag to false, and update the display (to draw o...
void drawObjectLabels(QList< SkyObject * > &labelObjects)
Proxy method for SkyMapDrawAbstract::drawObjectLabels()
Definition skymap.h:327
void resizeEvent(QResizeEvent *) override
If the skymap will be resized, the sky must be new computed.
void exportSkyImage(QPaintDevice *pd, bool scale=false)
Proxy method for SkyMapDrawAbstract::exportSkyImage()
Definition skymap.h:309
void objectChanged(SkyObject *)
Emitted when current object changed.
void slotCopyCoordinates()
slotCopyCoordinates Copies J2000 and JNow equatorial coordinates to the clipboard in addition to hori...
Definition skymap.cpp:504
void setClickedPoint(const SkyPoint *f)
Set the ClickedPoint to the skypoint given as an argument.
Definition skymap.cpp:1021
void slotToggleGeoBox(bool)
Toggle visibility of geo infobox.
Definition skymap.cpp:258
void slotCopyTLE()
slotCopyTLE Copy satellite TLE to clipboard.
Definition skymap.cpp:546
void slotAddPlanetTrail()
Add a Planet Trail to ClickedObject.
Definition skymap.cpp:897
void slotAddObjectLabel()
Add ClickedObject to KStarsData::ObjLabelList, which stores pointers to SkyObjects which have User La...
Definition skymap.cpp:881
void slotUpdateSky(bool now)
Update the focus point and call forceUpdate()
Definition skymap.cpp:458
void slotZoomOut()
Zoom out one step.
Definition skymap.cpp:1166
void setClickedObject(SkyObject *o)
Set the ClickedObject pointer to the argument.
Definition skymap.cpp:366
void slotEndRulerMode()
Computes the angular distance, prints the result in the status bar and disables the angular distance ...
Definition skymap.cpp:643
void updateInfoBoxes()
Update info boxes coordinates.
Definition skymap.cpp:335
const Projector * projector() const
Get the current projector.
Definition skymap.h:300
void positionChanged(SkyPoint *)
Emitted when pointing changed.
void mouseMoveEvent(QMouseEvent *e) override
This function does several different things depending on the state of the program:
void slotRemoveObjectLabel()
Remove ClickedObject from KStarsData::ObjLabelList, which stores pointers to SkyObjects which have Us...
Definition skymap.cpp:855
void slotClockSlewing()
Checks whether the timestep exceeds a threshold value.
Definition skymap.cpp:953
void slotCancelRulerMode()
Disables the angular distance measuring mode.
Definition skymap.cpp:749
void forceUpdate(bool now=false)
Recalculates the positions of objects in the sky, and then repaints the sky map.
Definition skymap.cpp:1186
void objectClicked(SkyObject *)
Emitted when a position is clicked.
SkyPoint * mousePoint()
Retrieve the mouse pointer position.
Definition skymap.h:227
SkyPoint * destination()
retrieve the Destination position.
Definition skymap.h:135
void slotRemovePlanetTrail()
Remove the PlanetTrail from ClickedObject.
Definition skymap.cpp:887
void setFocusAltAz(const dms &alt, const dms &az)
sets the focus point of the sky map, using its alt/az coordinates
Definition skymap.cpp:981
void mousePointChanged(SkyPoint *)
Emitted when position under mouse changed.
void updateAngleRuler()
update the geometry of the angle ruler.
Definition skymap.cpp:1366
void slotSetSkyRotation(double angle)
Sets the base sky rotation (before correction) to the given angle.
Definition skymap.cpp:1231
void slotDSS()
Popup menu function: Display 1st-Generation DSS image with the Image Viewer.
Definition skymap.cpp:472
void slotToggleInfoboxes(bool)
Toggle visibility of all infoboxes.
Definition skymap.cpp:273
void setDestination(const SkyPoint &f)
sets the destination point of the sky map.
Definition skymap.cpp:993
~SkyMap() override
Destructor (empty)
Definition skymap.cpp:279
void slotDisplayFadingText(const QString &text)
Render a fading text label on the screen to flash information.
Definition skymap.cpp:1386
SkyObject * clickedObject() const
Retrieve the object nearest to a mouse click event.
Definition skymap.h:244
void positionClicked(SkyPoint *)
Emitted when a position is clicked.
SkyMap()
Constructor.
Definition skymap.cpp:176
void forceUpdateNow()
Convenience function; simply calls forceUpdate(true).
Definition skymap.h:378
bool isObjectLabeled(SkyObject *o)
Definition skymap.cpp:840
void slotZoomDefault()
Set default zoom.
Definition skymap.cpp:1171
void wheelEvent(QWheelEvent *e) override
Zoom in and out with the mouse wheel.
void slotEditFlag(int flagIdx)
Open Flag Manager window with selected flag focused and ready to edit.
Definition skymap.cpp:798
void slotAddFlag()
Open Flag Manager window with clickedObject() RA and Dec entered.
Definition skymap.cpp:755
void slotImage()
Popup menu function: Show image of ClickedObject (only available for some objects).
Definition skymap.cpp:821
void destinationChanged()
Emitted by setDestination(), and connected to slewFocus().
void slotToggleFocusBox(bool)
Toggle visibility of focus infobox.
Definition skymap.cpp:263
void setDestinationAltAz(const dms &alt, const dms &az, bool altIsRefracted)
sets the destination point of the sky map, using its alt/az coordinates.
Definition skymap.cpp:1005
void slotAddFlagRaw()
Open Flag Manager window with RA and Dec entered.
Definition skymap.cpp:785
void slotStartXplanetViewer()
Run Xplanet Viewer to display images of the planets.
Definition skymap.cpp:1378
void slewFocus()
Step the Focus point toward the Destination point.
Definition skymap.cpp:1046
void updateFocus()
Update the focus position according to current options.
Definition skymap.cpp:1026
SkyPoint * clickedPoint()
Retrieve the ClickedPoint position.
Definition skymap.h:217
void removeSkyObject(SkyObject *object)
Emitted when a sky object is removed from the database.
void mouseDoubleClickEvent(QMouseEvent *e) override
Center SkyMap at double-clicked location
void slotBeginAngularDistance()
Enables the angular distance measuring mode.
Definition skymap.cpp:607
void slotDeleteFlag(int flagIdx)
Delete selected flag.
Definition skymap.cpp:807
void slotZoomIn()
Zoom in one step.
Definition skymap.cpp:1161
void keyPressEvent(QKeyEvent *e) override
Process keystrokes:
void setFocusObject(SkyObject *o)
Set the FocusObject pointer to the argument.
Definition skymap.cpp:371
void slotInfo()
Popup menu function: Show webpage about ClickedObject (only available for some objects).
Definition skymap.cpp:831
void slotCenter()
Center the display at the point ClickedPoint.
Definition skymap.cpp:380
void setFocusPoint(SkyPoint *f)
set the FocusPoint; the position that is to be the next Destination.
Definition skymap.h:204
SkyObject * focusObject() const
Retrieve the object which is centered in the sky map.
Definition skymap.h:262
void slotRemoveCustomObject()
Remove custom object from internet search in the local catalog.
Definition skymap.cpp:861
void mosaicCenterChanged(dms dRA, dms dDE)
Emitter when mosaic center is dragged in the sky map.
void mousePressEvent(QMouseEvent *e) override
Determine RA, Dec coordinates of clicked location.
void slotDetail()
Popup menu function: Show the Detailed Information window for ClickedObject.
Definition skymap.cpp:907
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:42
The sky coordinates of a point in the sky.
Definition skypoint.h:45
The QPainter-based painting backend.
Definition skyqpainter.h:31
An angle, stored as degrees, but expressible in many ways.
Definition dms.h:38
void scale(qreal sx, qreal sy)
Q_OBJECTQ_OBJECT
void setFocus()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.