Kstars

skymap.h
1 /*
2  SPDX-FileCopyrightText: 2001 Jason Harris <[email protected]>
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 
21 class QPainter;
22 class QPaintDevice;
23 
24 class dms;
25 class InfoBoxes;
26 class InfoBoxWidget;
27 class KSPopupMenu;
28 class KStarsData;
29 class Projector;
30 class SkyObject;
31 
32 #ifdef HAVE_OPENGL
33 class SkyMapGLDraw;
34 class 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  */
53 class SkyMap : public QGraphicsView
54 {
55  Q_OBJECT
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  */
252  void setClickedObject(SkyObject *o);
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  */
463  void slotRemoveObjectLabel();
464 
465  /** Remove custom object from internet search in the local catalog */
466  void slotRemoveCustomObject();
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  */
481  void slotRemovePlanetTrail();
482 
483  /** Checks whether the timestep exceeds a threshold value. If so, sets
484  * ClockSlewing=true and sets the SimClock to ManualMode.
485  */
486  void slotClockSlewing();
487 
488  /** Enables the angular distance measuring mode. It saves the first
489  * position of the ruler in a SkyPoint. It makes difference between
490  * having clicked on the skymap and not having done so
491  * \note This method is draw-backend independent.
492  */
494 
495  void slotBeginStarHop(); // TODO: Add docs
496 
497  /** Computes the angular distance, prints the result in the status
498  * bar and disables the angular distance measuring mode
499  * If the user has clicked on the map the status bar shows the
500  * name of the clicked object plus the angular distance. If
501  * the user did not clicked on the map, just pressed ], only
502  * the angular distance is printed
503  * \note This method is draw-backend independent.
504  */
505  void slotEndRulerMode();
506 
507  /** Disables the angular distance measuring mode. Nothing is printed
508  * in the status bar */
509  void slotCancelRulerMode();
510 
511  /** @short Open Flag Manager window with clickedObject() RA and Dec entered.
512  */
513  void slotAddFlag();
514 
515  /** @short Open Flag Manager window with selected flag focused and ready to edit.
516  *@param flagIdx index of flag to be edited.
517  */
518  void slotEditFlag(int flagIdx);
519 
520  /** @short Delete selected flag.
521  *@param flagIdx index of flag to be deleted.
522  */
523  void slotDeleteFlag(int flagIdx);
524 
525 #ifdef HAVE_OPENGL
526  void slotToggleGL();
527 #endif
528 
529  /** Run Xplanet Viewer to display images of the planets*/
530  void slotStartXplanetViewer();
531 
532  /** Render eyepiece view */
533  void slotEyepieceView();
534 
535  /** Zoom in one step. */
536  void slotZoomIn();
537 
538  /** Zoom out one step. */
539  void slotZoomOut();
540 
541  /** Set default zoom. */
542  void slotZoomDefault();
543 
544  /** Object pointing for Printing Wizard done */
545  void slotObjectSelected();
546 
547  void slotCancelLegendPreviewMode();
548 
549  void slotFinishFovCaptureMode();
550 
551  void slotCaptureFov();
552 
553  signals:
554  /** Emitted by setDestination(), and connected to slewFocus(). Whenever the Destination
555  * point is changed, slewFocus() will iteratively step the Focus toward Destination
556  * until it is reached.
557  * @see SkyMap::setDestination()
558  * @see SkyMap::slewFocus()
559  */
560  void destinationChanged();
561 
562  /** Emitted when zoom level is changed. */
563  void zoomChanged();
564 
565  /** Emitted when current object changed. */
566  void objectChanged(SkyObject *);
567 
568  /** Emitted when pointing changed. (At least should) */
569  void positionChanged(SkyPoint *);
570 
571  /** Emitted when position under mouse changed. */
572  void mousePointChanged(SkyPoint *);
573 
574  /** Emitted when a position is clicked */
575  void positionClicked(SkyPoint *);
576 
577  /** Emitted when a position is clicked */
578  void objectClicked(SkyObject *);
579 
580  /** Emitted when a sky object is removed from the database */
581  void removeSkyObject(SkyObject *object);
582 
583  /** Emitter when mosaic center is dragged in the sky map */
584  void mosaicCenterChanged(dms dRA, dms dDE);
585 
586  void updateQueued();
587 
588  protected:
589  bool event(QEvent *event) override;
590 
591  /** Process keystrokes:
592  * @li arrow keys Slew the map
593  * @li +/- keys Zoom in and out
594  * @li <i>Space</i> Toggle between Horizontal and Equatorial coordinate systems
595  * @li 0-9 Go to a major Solar System body (0=Sun; 1-9 are the major planets, except 3=Moon)
596  * @li [ Place starting point for measuring an angular distance
597  * @li ] End point for Angular Distance; display measurement.
598  * @li <i>Escape</i> Cancel Angular measurement
599  * @li ,/< Step backward one time step
600  * @li ./> Step forward one time step
601  */
602  void keyPressEvent(QKeyEvent *e) override;
603 
604  /** When keyRelease is triggered, just set the "slewing" flag to false,
605  * and update the display (to draw objects that are hidden when slewing==true). */
606  void keyReleaseEvent(QKeyEvent *e) override;
607 
608  /** Determine RA, Dec coordinates of clicked location. Find the SkyObject
609  * which is nearest to the clicked location.
610  *
611  * If left-clicked: Set set mouseButtonDown==true, slewing==true; display
612  * nearest object name in status bar.
613  * If right-clicked: display popup menu appropriate for nearest object.
614  */
615  void mousePressEvent(QMouseEvent *e) override;
616 
617  /** set mouseButtonDown==false, slewing==false */
618  void mouseReleaseEvent(QMouseEvent *e) override;
619 
620  /** Center SkyMap at double-clicked location */
621  void mouseDoubleClickEvent(QMouseEvent *e) override;
622 
623  /** This function does several different things depending on the state of the program:
624  * @li If Angle-measurement mode is active, update the end-ruler point to the mouse cursor,
625  * and continue this function.
626  * @li If we are defining a ZoomBox, update the ZoomBox rectangle, redraw the screen,
627  * and return.
628  * @li If dragging the mouse in the map, update focus such that RA, Dec under the mouse
629  * cursor remains constant.
630  * @li If just moving the mouse, simply update the curso coordinates in the status bar.
631  */
632  void mouseMoveEvent(QMouseEvent *e) override;
633 
634  /** Zoom in and out with the mouse wheel. */
635  void wheelEvent(QWheelEvent *e) override;
636 
637  /** If the skymap will be resized, the sky must be new computed. So this
638  * function calls explicitly new computing of the skymap.
639  */
640  void resizeEvent(QResizeEvent *) override;
641 
642  private slots:
643  /** @short display tooltip for object under cursor. It's called by m_HoverTimer.
644  * if mouse didn't moved for last HOVER_INTERVAL milliseconds.
645  */
646  void slotTransientLabel();
647 
648  /** Set the shape of mouse cursor to a cross with 4 arrows. */
649  void setMouseMoveCursor();
650 
651  /** Set the shape of mouse cursor to an open hand. */
652  void setMouseDragCursor();
653 
654  private:
655 
656  /** @short Sets the shape of the mouse cursor to a magnifying glass. */
657  void setZoomMouseCursor();
658 
659  /** @short Sets the shape of the mouse cursor to a rotation symbol. */
660  void setRotationMouseCursor();
661 
662  /** Calculate the zoom factor for the given keyboard modifier
663  */
664  double zoomFactor(const int modifier);
665 
666  /** calculate the magnitude factor (1, .5, .2, or .1) for the given
667  * keyboard modifier.
668  */
669  double magFactor(const int modifier);
670 
671  /** Decrease the magnitude limit by a step size determined by the
672  * keyboard modifier.
673  * @param modifier
674  */
675  void decMagLimit(const int modifier);
676 
677  /** Increase the magnitude limit by a step size determined by the
678  * keyboard modifier.
679  * @param modifier
680  */
681  void incMagLimit(const int modifier);
682 
683  /** Convenience routine to either zoom in or increase mag limit
684  * depending on the Alt modifier. The Shift and Control modifiers
685  * will adjust the size of the zoom or the mag step.
686  * @param modifier
687  */
688  void zoomInOrMagStep(const int modifier);
689 
690  /** Convenience routine to either zoom out or decrease mag limit
691  * depending on the Alt modifier. The Shift and Control modifiers
692  * will adjust the size of the zoom or the mag step.
693  * @param modifier
694  */
695  void zoomOutOrMagStep(const int modifier);
696 
697  void beginRulerMode(bool starHopRuler); // TODO: Add docs
698 
699  /**
700  * Determine the rotation angle of the SkyMap
701  *
702  * This is simply Options::skyRotation() if the erect observer
703  * correction is not applicable, but otherwise it is
704  * determined by adding a correction amount dependent on the
705  * focus of the sky map
706  */
707  dms determineSkyRotation();
708 
709  /**
710  * @short Strart xplanet.
711  * @param outputFile Output file path.
712  */
713  void startXplanet(const QString &outputFile = "");
714 
715  bool mouseButtonDown { false };
716  bool midMouseButtonDown { false };
717  /// True if mouseMoveEvent; needed by setMouseMoveCursor
718  bool mouseMoveCursor { false };
719  bool mouseDragCursor { false };
720  bool slewing { false };
721  bool clockSlewing { false };
722  //if false only old pixmap will repainted with bitBlt(), this
723  // saves a lot of cpu usage
724  bool computeSkymap { false };
725  // True if we are either looking for angular distance or star hopping directions
726  bool rulerMode { false };
727  // True only if we are looking for star hopping directions. If
728  // false while rulerMode is true, it means we are measuring angular
729  // distance. FIXME: Find a better way to do this
730  bool starHopDefineMode { false };
731  double y0;
732 
733  QPoint rotationStart;
734  dms rotationStartAngle;
735 
736  double m_Scale;
737 
738  KStarsData *data { nullptr };
739  KSPopupMenu *pmenu { nullptr };
740 
741  /// Coordinates of point under cursor. It's update in function mouseMoveEvent
742  SkyPoint m_MousePoint;
743 
744  SkyPoint Focus, ClickedPoint, FocusPoint, Destination;
745  SkyObject *ClickedObject { nullptr };
746  SkyObject *FocusObject { nullptr };
747 
748  Projector *m_proj { nullptr };
749 
750  SkyLine AngularRuler; //The line for measuring angles in the map
751  QRect ZoomRect; //The manual-focus circle.
752 
753  // Mouse should not move for that interval to display tooltip
754  static const int HOVER_INTERVAL = 500;
755  // Timer for tooltips
756  QTimer m_HoverTimer;
757 
758  // InfoBoxes. Used in destructor to save state
759  InfoBoxWidget *m_timeBox { nullptr };
760  InfoBoxWidget *m_geoBox { nullptr };
761  InfoBoxWidget *m_objBox { nullptr };
762  InfoBoxes *m_iboxes { nullptr };
763 
764  // legend
765  bool m_previewLegend { false };
766  Legend m_legend;
767 
768  bool m_objPointingMode { false };
769  bool m_fovCaptureMode { false };
770  bool m_touchMode { false };
771  bool m_pinchMode { false };
772  bool m_tapAndHoldMode { false };
773  qreal m_pinchScale { 0.0 };
774 
775  QWidget *m_SkyMapDraw { nullptr }; // Can be dynamic_cast<> to SkyMapDrawAbstract
776 
777  // NOTE: These are pointers to the individual widgets
778 #ifdef HAVE_OPENGL
779  SkyMapQDraw *m_SkyMapQDraw { nullptr };
780  SkyMapGLDraw *m_SkyMapGLDraw { nullptr };
781 #endif
782 
783  static SkyMap *pinstance;
784  /// Good to keep the original ruler start-point for purposes of dynamic_cast
785  const SkyPoint *m_rulerStartPoint { nullptr };
786 };
Q_OBJECTQ_OBJECT
void objectClicked(SkyObject *)
Emitted when a position is clicked.
void mousePressEvent(QMouseEvent *e) override
Determine RA, Dec coordinates of clicked location.
void destinationChanged()
Emitted by setDestination(), and connected to slewFocus().
void slotUpdateSky(bool now)
Update the focus point and call forceUpdate()
Definition: skymap.cpp:455
The QPainter-based painting backend.
Definition: skyqpainter.h:30
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:995
void slotZoomOut()
Zoom out one step.
Definition: skymap.cpp:1156
void forceUpdateNow()
Convenience function; simply calls forceUpdate(true).
Definition: skymap.h:378
~SkyMap() override
Destructor (empty)
Definition: skymap.cpp:276
void mosaicCenterChanged(dms dRA, dms dDE)
Emitter when mosaic center is dragged in the sky map.
SkyPoint * clickedPoint()
Retrieve the ClickedPoint position.
Definition: skymap.h:217
Stores dms coordinates for a point in the sky. for converting between coordinate systems.
Definition: skypoint.h:44
void mouseMoveEvent(QMouseEvent *e) override
This function does several different things depending on the state of the program:
void setZoomFactor(double factor)
@ Set zoom factor.
Definition: skymap.cpp:1166
void slotZoomDefault()
Set default zoom.
Definition: skymap.cpp:1161
void setClickedPoint(const SkyPoint *f)
Set the ClickedPoint to the skypoint given as an argument.
Definition: skymap.cpp:1011
void resizeEvent(QResizeEvent *) override
If the skymap will be resized, the sky must be new computed.
virtual bool event(QEvent *event) override
void slotObjectSelected()
Object pointing for Printing Wizard done.
Definition: skymap.cpp:910
void showFocusCoords()
Update object name and coordinates in the Focus InfoBox.
Definition: skymap.cpp:324
void drawObjectLabels(QList< SkyObject * > &labelObjects)
Proxy method for SkyMapDrawAbstract::drawObjectLabels()
Definition: skymap.h:327
SkyObject * clickedObject() const
Retrieve the object nearest to a mouse click event.
Definition: skymap.h:244
void scale(qreal sx, qreal sy)
This class defines the methods that both rendering engines (GLPainter and QPainter) must implement.
bool isObjectLabeled(SkyObject *o)
Definition: skymap.cpp:830
void slotAddObjectLabel()
Add ClickedObject to KStarsData::ObjLabelList, which stores pointers to SkyObjects which have User La...
Definition: skymap.cpp:871
void slotImage()
Popup menu function: Show image of ClickedObject (only available for some objects).
Definition: skymap.cpp:811
void setFocusObject(SkyObject *o)
Set the FocusObject pointer to the argument.
Definition: skymap.cpp:368
void exportSkyImage(QPaintDevice *pd, bool scale=false)
Proxy method for SkyMapDrawAbstract::exportSkyImage()
Definition: skymap.h:309
void slotEditFlag(int flagIdx)
Open Flag Manager window with selected flag focused and ready to edit.
Definition: skymap.cpp:788
void slotEndRulerMode()
Computes the angular distance, prints the result in the status bar and disables the angular distance ...
Definition: skymap.cpp:646
void setMouseCursorShape(Cursor type)
Sets the shape of the default mouse cursor.
Definition: skymap.cpp:1300
The InfoBoxes class is a collection of InfoBoxWidget objects that display a transparent box for displ...
Definition: infoboxwidget.h:22
void setDestination(const SkyPoint &f)
sets the destination point of the sky map.
Definition: skymap.cpp:983
void keyPressEvent(QKeyEvent *e) override
Process keystrokes:
float fov()
Definition: skymap.cpp:1196
SkyPoint * destination()
retrieve the Destination position.
Definition: skymap.h:135
void slotSDSS()
Popup menu function: Display Sloan Digital Sky Survey image with the Image Viewer.
Definition: skymap.cpp:562
This class draws the SkyMap using native QPainter.
Definition: skymapqdraw.h:21
void slotRemoveCustomObject()
Remove custom object from internet search in the local catalog.
Definition: skymap.cpp:851
void slotRemoveObjectLabel()
Remove ClickedObject from KStarsData::ObjLabelList, which stores pointers to SkyObjects which have Us...
Definition: skymap.cpp:845
SkyPoint * focus()
Retrieve the Focus point; the position on the sky at the center of the skymap.
Definition: skymap.h:123
void wheelEvent(QWheelEvent *e) override
Zoom in and out with the mouse wheel.
void positionChanged(SkyPoint *)
Emitted when pointing changed.
void updateFocus()
Update the focus position according to current options.
Definition: skymap.cpp:1016
This class draws the SkyMap using OpenGL.
Definition: skymapgldraw.h:20
void setupProjector()
Call to set up the projector before a draw cycle.
Definition: skymap.cpp:1238
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 objectChanged(SkyObject *)
Emitted when current object changed.
void setFocusPoint(SkyPoint *f)
set the FocusPoint; the position that is to be the next Destination.
Definition: skymap.h:204
void setClickedObject(SkyObject *o)
Set the ClickedObject pointer to the argument.
Definition: skymap.cpp:363
void slotStartXplanetViewer()
Run Xplanet Viewer to display images of the planets.
Definition: skymap.cpp:1360
void positionClicked(SkyPoint *)
Emitted when a position is clicked.
void slotToggleFocusBox(bool)
Toggle visibility of focus infobox.
Definition: skymap.cpp:260
void slotAddFlag()
Open Flag Manager window with clickedObject() RA and Dec entered.
Definition: skymap.cpp:758
void slotDSS()
Popup menu function: Display 1st-Generation DSS image with the Image Viewer.
Definition: skymap.cpp:469
void slewFocus()
Step the Focus point toward the Destination point.
Definition: skymap.cpp:1036
void slotRemovePlanetTrail()
Remove the PlanetTrail from ClickedObject.
Definition: skymap.cpp:877
void slotClockSlewing()
Checks whether the timestep exceeds a threshold value.
Definition: skymap.cpp:943
void slotDetail()
Popup menu function: Show the Detailed Information window for ClickedObject.
Definition: skymap.cpp:897
void slotDeleteFlag(int flagIdx)
Delete selected flag.
Definition: skymap.cpp:797
void slotAddPlanetTrail()
Add a Planet Trail to ClickedObject.
Definition: skymap.cpp:887
void slotToggleTimeBox(bool)
Toggle visibility of time infobox.
Definition: skymap.cpp:265
void slotCenter()
Center the display at the point ClickedPoint.
Definition: skymap.cpp:377
An angle, stored as degrees, but expressible in many ways.
Definition: dms.h:37
void slotCopyTLE()
slotCopyTLE Copy satellite TLE to clipboard.
Definition: skymap.cpp:544
void updateInfoBoxes()
Update info boxes coordinates.
Definition: skymap.cpp:332
SkyObject * focusObject() const
Retrieve the object which is centered in the sky map.
Definition: skymap.h:262
void slotBeginAngularDistance()
Enables the angular distance measuring mode.
Definition: skymap.cpp:610
SkyMap()
Constructor.
Definition: skymap.cpp:173
void slotCancelRulerMode()
Disables the angular distance measuring mode.
Definition: skymap.cpp:752
Canvas widget for displaying the sky bitmap; also handles user interaction events.
Definition: skymap.h:53
void slotEyepieceView()
Render eyepiece view.
Definition: skymap.cpp:606
SkyPoint * mousePoint()
Retrieve the mouse pointer position.
Definition: skymap.h:227
The InfoBoxWidget class is a widget that displays a transparent box for display of text messages.
Definition: infoboxwidget.h:44
void slotToggleGeoBox(bool)
Toggle visibility of geo infobox.
Definition: skymap.cpp:255
void updateAngleRuler()
update the geometry of the angle ruler.
Definition: skymap.cpp:1348
SkyPoint * focusPoint()
retrieve the FocusPoint position.
Definition: skymap.h:149
void slotCopyCoordinates()
slotCopyCoordinates Copies J2000 and JNow equatorial coordinates to the clipboard in addition to hori...
Definition: skymap.cpp:501
void mouseReleaseEvent(QMouseEvent *e) override
set mouseButtonDown==false, slewing==false
void forceUpdate(bool now=false)
Recalculates the positions of objects in the sky, and then repaints the sky map.
Definition: skymap.cpp:1176
void slotSetSkyRotation(double angle)
Sets the base sky rotation (before correction) to the given angle.
Definition: skymap.cpp:1215
void slotZoomIn()
Zoom in one step.
Definition: skymap.cpp:1151
const Projector * projector() const
Get the current projector.
Definition: skymap.h:300
void mousePointChanged(SkyPoint *)
Emitted when position under mouse changed.
void keyReleaseEvent(QKeyEvent *e) override
When keyRelease is triggered, just set the "slewing" flag to false, and update the display (to draw o...
void setFocusAltAz(const dms &alt, const dms &az)
sets the focus point of the sky map, using its alt/az coordinates
Definition: skymap.cpp:971
void setFocus()
Information about an object in the sky.
Definition: skyobject.h:41
void zoomChanged()
Emitted when zoom level is changed.
void slotInfo()
Popup menu function: Show webpage about ClickedObject (only available for some objects).
Definition: skymap.cpp:821
Legend class is used for painting legends on class inheriting QPaintDevice. Its methods enable changi...
Definition: legend.h:32
void slotToggleInfoboxes(bool)
Toggle visibility of all infoboxes.
Definition: skymap.cpp:270
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Oct 1 2023 04:02:44 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.