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

KDE's Doxygen guidelines are available online.