File indexing completed on 2022-12-06 18:58:52

0001 /*
0002     SPDX-FileCopyrightText: 2001 Jason Harris <jharris@30doradus.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "config-kstars.h"
0010 
0011 #include "skymapdrawabstract.h"
0012 #include "printing/legend.h"
0013 #include "skyobjects/skypoint.h"
0014 #include "skyobjects/skyline.h"
0015 
0016 #include <QGraphicsView>
0017 #include <QtGlobal>
0018 #include <QTimer>
0019 
0020 class QPainter;
0021 class QPaintDevice;
0022 
0023 class dms;
0024 class InfoBoxes;
0025 class InfoBoxWidget;
0026 class KSPopupMenu;
0027 class KStarsData;
0028 class Projector;
0029 class SkyObject;
0030 
0031 #ifdef HAVE_OPENGL
0032 class SkyMapGLDraw;
0033 class SkyMapQDraw;
0034 #endif
0035 
0036 /**
0037  * @class SkyMap
0038  *
0039  * This is the canvas on which the sky is painted.  It's the main widget for KStars.
0040  * Contains SkyPoint members for the map's Focus (current central position), Destination
0041  * (requested central position), FocusPoint (next queued position to be focused),
0042  * MousePoint (position of mouse cursor), and ClickedPoint (position of last mouse click).
0043  * Also contains the InfoBoxes for on-screen data display.
0044  *
0045  * SkyMap handles most user interaction events (both mouse and keyboard).
0046  *
0047  * @short Canvas widget for displaying the sky bitmap; also handles user interaction events.
0048  *
0049  * @author Jason Harris
0050  * @version 1.0
0051  */
0052 class SkyMap : public QGraphicsView
0053 {
0054         Q_OBJECT
0055 
0056         friend class SkyMapDrawAbstract; // FIXME: SkyMapDrawAbstract requires a lot of access to SkyMap
0057         friend class SkyMapQDraw;        // FIXME: SkyMapQDraw requires access to computeSkymap
0058 
0059     protected:
0060         /**
0061             *Constructor.  Read stored settings from KConfig object (focus position,
0062             *zoom factor, sky color, etc.).  Run initPopupMenus().
0063             */
0064         SkyMap();
0065 
0066     public:
0067         static SkyMap *Create();
0068 
0069         static SkyMap *Instance();
0070 
0071         static bool IsFocused()
0072         {
0073             //return (pinstance->focusObject() || pinstance->focusPoint());
0074             return (pinstance->focusObject());
0075         }
0076 
0077         static bool IsSlewing()
0078         {
0079             return pinstance->isSlewing();
0080         }
0081 
0082         /** Destructor (empty) */
0083         ~SkyMap() override;
0084 
0085         enum Projection
0086         {
0087             Lambert,
0088             AzimuthalEquidistant,
0089             Orthographic,
0090             Equirectangular,
0091             Stereographic,
0092             Gnomonic,
0093             UnknownProjection
0094         };
0095 
0096         enum Cursor
0097         {
0098             NoCursor,
0099             Cross,
0100             Circle,
0101         };
0102 
0103         /** @return the angular field of view of the sky map, in degrees.
0104             *@note it must use either the height or the width of the window to calculate the
0105             *FOV angle.  It chooses whichever is larger.
0106             */
0107         float fov();
0108 
0109         /** @short Update object name and coordinates in the Focus InfoBox */
0110         void showFocusCoords();
0111 
0112         /** @brief Update info boxes coordinates */
0113         void updateInfoBoxes();
0114 
0115         /** @short Update the focus position according to current options. */
0116         void updateFocus();
0117 
0118         /** @short Retrieve the Focus point; the position on the sky at the
0119                 *center of the skymap.
0120                 *@return a pointer to the central focus point of the sky map
0121                 */
0122         SkyPoint *focus()
0123         {
0124             return &Focus;
0125         }
0126 
0127         /** @short retrieve the Destination position.
0128                 *
0129                 *The Destination is the point on the sky to which the focus will
0130                 *be moved.
0131                 *
0132                 *@return a pointer to the destination point of the sky map
0133                 */
0134         SkyPoint *destination()
0135         {
0136             return &Destination;
0137         }
0138 
0139         /** @short retrieve the FocusPoint position.
0140                 *
0141                 *The FocusPoint stores the position on the sky that is to be
0142                 *focused next.  This is not exactly the same as the Destination
0143                 *point, because when the Destination is set, it will begin slewing
0144                 *immediately.
0145                 *
0146                 *@return a pointer to the sky point which is to be focused next.
0147                 */
0148         SkyPoint *focusPoint()
0149         {
0150             return &FocusPoint;
0151         }
0152 
0153         /** @short sets the central focus point of the sky map.
0154                 *@param f a pointer to the SkyPoint the map should be centered on
0155                 */
0156         void setFocus(SkyPoint *f);
0157 
0158         /** @short sets the focus point of the skymap, using ra/dec coordinates
0159                 *
0160                 *@note This function behaves essentially like the above function.
0161                 *It differs only in the data types of its arguments.
0162                 *
0163                 *@param ra the new right ascension
0164                 *@param dec the new declination
0165                 */
0166         void setFocus(const dms &ra, const dms &dec);
0167 
0168         /** @short sets the focus point of the sky map, using its alt/az coordinates
0169                 *@param alt the new altitude (actual, without refraction correction)
0170                 *@param az the new azimuth
0171                 */
0172         void setFocusAltAz(const dms &alt, const dms &az);
0173 
0174         /** @short sets the destination point of the sky map.
0175                 *@note setDestination() emits the destinationChanged() SIGNAL,
0176                 *which triggers the SLOT function SkyMap::slewFocus().  This
0177                 *function iteratively steps the Focus point toward Destination,
0178                 *repainting the sky at each step (if Options::useAnimatedSlewing()==true).
0179                 *@param f a pointer to the SkyPoint the map should slew to
0180                 */
0181         void setDestination(const SkyPoint &f);
0182 
0183         /** @short sets the destination point of the skymap, using ra/dec coordinates.
0184                 *
0185                 *@note This function behaves essentially like the above function.
0186                 *It differs only in the data types of its arguments.
0187                 *
0188                 *@param ra the new right ascension
0189                 *@param dec the new declination
0190                 */
0191         void setDestination(const dms &ra, const dms &dec);
0192 
0193         /** @short sets the destination point of the sky map, using its alt/az coordinates.
0194                 *@param alt the new altitude
0195                 *@param az the new azimuth
0196                 *@param altIsRefracted set to true if the altitude supplied is apparent
0197                 */
0198         void setDestinationAltAz(const dms &alt, const dms &az, bool altIsRefracted);
0199 
0200         /** @short set the FocusPoint; the position that is to be the next Destination.
0201                 *@param f a pointer to the FocusPoint SkyPoint.
0202                 */
0203         void setFocusPoint(SkyPoint *f)
0204         {
0205             if (f)
0206                 FocusPoint = *f;
0207         }
0208 
0209         /** @short Retrieve the ClickedPoint position.
0210                 *
0211                 *When the user clicks on a point in the sky map, the sky coordinates of the mouse
0212                 *cursor are stored in the private member ClickedPoint.  This function retrieves
0213                 *a pointer to ClickedPoint.
0214                 *@return a pointer to ClickedPoint, the sky coordinates where the user clicked.
0215                 */
0216         SkyPoint *clickedPoint()
0217         {
0218             return &ClickedPoint;
0219         }
0220 
0221         /**
0222          * @short Retrieve the mouse pointer position.
0223          *
0224          * @return The sky coordinates where the mouse pointer is over.
0225          */
0226         SkyPoint *mousePoint()
0227         {
0228             return &m_MousePoint;
0229         }
0230 
0231         /** @short Set the ClickedPoint to the skypoint given as an argument.
0232                 *@param f pointer to the new ClickedPoint.
0233                 */
0234         void setClickedPoint(const SkyPoint *f);
0235 
0236         /** @short Retrieve the object nearest to a mouse click event.
0237                 *
0238                 *If the user clicks on the sky map, a pointer to the nearest SkyObject is stored in
0239                 *the private member ClickedObject.  This function returns the ClickedObject pointer,
0240                 *or nullptr if there is no CLickedObject.
0241                 *@return a pointer to the object nearest to a user mouse click.
0242                 */
0243         SkyObject *clickedObject() const
0244         {
0245             return ClickedObject;
0246         }
0247 
0248         /** @short Set the ClickedObject pointer to the argument.
0249                 *@param o pointer to the SkyObject to be assigned as the ClickedObject
0250                 */
0251         void setClickedObject(SkyObject *o);
0252 
0253         /** @short Retrieve the object which is centered in the sky map.
0254                 *
0255                 *If the user centers the sky map on an object (by double-clicking or using the
0256                 *Find Object dialog), a pointer to the "focused" object is stored in
0257                 *the private member FocusObject.  This function returns a pointer to the
0258                 *FocusObject, or nullptr if there is not FocusObject.
0259                 *@return a pointer to the object at the center of the sky map.
0260                 */
0261         SkyObject *focusObject() const
0262         {
0263             return FocusObject;
0264         }
0265 
0266         /** @short Set the FocusObject pointer to the argument.
0267                 *@param o pointer to the SkyObject to be assigned as the FocusObject
0268                 */
0269         void setFocusObject(SkyObject *o);
0270 
0271         /** @short Call to set up the projector before a draw cycle. */
0272         void setupProjector();
0273 
0274         /** @ Set zoom factor.
0275               *@param factor zoom factor
0276               */
0277         void setZoomFactor(double factor);
0278 
0279         bool isSlewing() const;
0280 
0281         // NOTE: This method is draw-backend independent.
0282         /** @short update the geometry of the angle ruler. */
0283         void updateAngleRuler();
0284 
0285         /** @return true if the object currently has a user label attached.
0286                 *@note this function only checks for a label explicitly added to the object
0287                 *with the right-click popup menu; other kinds of labels are not detected by
0288                 *this function.
0289                 *@param o pointer to the sky object to be tested for a User label.
0290                 */
0291         bool isObjectLabeled(SkyObject *o);
0292 
0293         /*@*@short Convenience function for shutting off tracking mode.  Just calls KStars::slotTrack().
0294                 */
0295         void stopTracking();
0296 
0297         /** Get the current projector.
0298                 @return a pointer to the current projector. */
0299         inline const Projector *projector() const
0300         {
0301             return m_proj;
0302         }
0303 
0304         // NOTE: These dynamic casts must not segfault. If they do, it's good because we know that there is a problem.
0305         /**
0306              *@short Proxy method for SkyMapDrawAbstract::exportSkyImage()
0307              */
0308         inline void exportSkyImage(QPaintDevice *pd, bool scale = false)
0309         {
0310             dynamic_cast<SkyMapDrawAbstract *>(m_SkyMapDraw)->exportSkyImage(pd, scale);
0311         }
0312 
0313         inline void exportSkyImage(SkyQPainter *painter, bool scale = false)
0314         {
0315             dynamic_cast<SkyMapDrawAbstract *>(m_SkyMapDraw)->exportSkyImage(painter, scale);
0316         }
0317 
0318         SkyMapDrawAbstract *getSkyMapDrawAbstract()
0319         {
0320             return dynamic_cast<SkyMapDrawAbstract *>(m_SkyMapDraw);
0321         }
0322 
0323         /**
0324              *@short Proxy method for SkyMapDrawAbstract::drawObjectLabels()
0325              */
0326         inline void drawObjectLabels(QList<SkyObject *> &labelObjects)
0327         {
0328             dynamic_cast<SkyMapDrawAbstract *>(m_SkyMapDraw)->drawObjectLabels(labelObjects);
0329         }
0330 
0331         void setPreviewLegend(bool preview)
0332         {
0333             m_previewLegend = preview;
0334         }
0335 
0336         void setLegend(const Legend &legend)
0337         {
0338             m_legend = legend;
0339         }
0340 
0341         bool isInObjectPointingMode() const
0342         {
0343             return m_objPointingMode;
0344         }
0345 
0346         void setObjectPointingMode(bool enabled)
0347         {
0348             m_objPointingMode = enabled;
0349         }
0350 
0351         void setFovCaptureMode(bool enabled)
0352         {
0353             m_fovCaptureMode = enabled;
0354         }
0355 
0356         bool isInFovCaptureMode() const
0357         {
0358             return m_fovCaptureMode;
0359         }
0360 
0361         /** @short Sets the shape of the default mouse cursor. */
0362         void setMouseCursorShape(Cursor type);
0363 
0364         SkyPoint getCenterPoint();
0365 
0366     public slots:
0367         /** Recalculates the positions of objects in the sky, and then repaints the sky map.
0368              * If the positions don't need to be recalculated, use update() instead of forceUpdate().
0369              * This saves a lot of CPU time.
0370              * @param now if true, paintEvent() is run immediately.  Otherwise, it is added to the event queue
0371              */
0372         void forceUpdate(bool now = false);
0373 
0374         /** @short Convenience function; simply calls forceUpdate(true).
0375              * @see forceUpdate()
0376              */
0377         void forceUpdateNow()
0378         {
0379             forceUpdate(true);
0380         }
0381 
0382         /**
0383              * @short Update the focus point and call forceUpdate()
0384              * @param now is passed on to forceUpdate()
0385              */
0386         void slotUpdateSky(bool now);
0387 
0388         /** Toggle visibility of geo infobox */
0389         void slotToggleGeoBox(bool);
0390 
0391         /** Toggle visibility of focus infobox */
0392         void slotToggleFocusBox(bool);
0393 
0394         /** Toggle visibility of time infobox */
0395         void slotToggleTimeBox(bool);
0396 
0397         /** Toggle visibility of all infoboxes */
0398         void slotToggleInfoboxes(bool);
0399 
0400         /** Step the Focus point toward the Destination point.  Do this iteratively, redrawing the Sky
0401              * Map after each step, until the Focus point is within 1 step of the Destination point.
0402              * For the final step, snap directly to Destination, and redraw the map.
0403              */
0404         void slewFocus();
0405 
0406         /** @short Center the display at the point ClickedPoint.
0407              *
0408              * The essential part of the function is to simply set the Destination point, which will emit
0409              * the destinationChanged() SIGNAL, which triggers the slewFocus() SLOT.  Additionally, this
0410              * function performs some bookkeeping tasks, such updating whether we are tracking the new
0411              * object/position, adding a Planet Trail if required, etc.
0412              *
0413              * @see destinationChanged()
0414              * @see slewFocus()
0415              */
0416         void slotCenter();
0417 
0418         /** @short Popup menu function: Display 1st-Generation DSS image with the Image Viewer.
0419              * @note the URL is generated using the coordinates of ClickedPoint.
0420              */
0421         void slotDSS();
0422 
0423         /** @short Popup menu function: Display Sloan Digital Sky Survey image with the Image Viewer.
0424              * @note the URL is generated using the coordinates of ClickedPoint.
0425              */
0426         void slotSDSS();
0427 
0428         /**
0429          * @brief slotCopyCoordinates Copies J2000 and JNow equatorial coordinates to the clipboard in addition to horizontal coords.
0430          */
0431         void slotCopyCoordinates();
0432 
0433         /**
0434          * @brief slotCopyTLE Copy satellite TLE to clipboard.
0435          */
0436         void slotCopyTLE();
0437 
0438         /** @short Popup menu function: Show webpage about ClickedObject
0439              * (only available for some objects).
0440              */
0441         void slotInfo();
0442 
0443         /** @short Popup menu function: Show image of ClickedObject
0444              * (only available for some objects).
0445              */
0446         void slotImage();
0447 
0448         /** @short Popup menu function: Show the Detailed Information window for ClickedObject. */
0449         void slotDetail();
0450 
0451         /** Add ClickedObject to KStarsData::ObjLabelList, which stores pointers to SkyObjects which
0452              * have User Labels attached.
0453              */
0454         void slotAddObjectLabel();
0455 
0456         /** Remove ClickedObject from KStarsData::ObjLabelList, which stores pointers to SkyObjects which
0457              * have User Labels attached.
0458              */
0459         void slotRemoveObjectLabel();
0460 
0461         /** Remove custom object from internet search in the local catalog */
0462         void slotRemoveCustomObject();
0463 
0464         /** @short Add a Planet Trail to ClickedObject.
0465              * @note Trails are added simply by calling KSPlanetBase::addToTrail() to add the first point.
0466              * as long as the trail is not empty, new points will be automatically appended to it.
0467              * @note if ClickedObject is not a Solar System body, this function does nothing.
0468              * @see KSPlanetBase::addToTrail()
0469              */
0470         void slotAddPlanetTrail();
0471 
0472         /** @short Remove the PlanetTrail from ClickedObject.
0473              * @note The Trail is removed by simply calling KSPlanetBase::clearTrail().  As long as
0474              * the trail is empty, no new points will be automatically appended.
0475              * @see KSPlanetBase::clearTrail()
0476              */
0477         void slotRemovePlanetTrail();
0478 
0479         /** Checks whether the timestep exceeds a threshold value.  If so, sets
0480              * ClockSlewing=true and sets the SimClock to ManualMode.
0481              */
0482         void slotClockSlewing();
0483 
0484         /** Enables the angular distance measuring mode. It saves the first
0485              * position of the ruler in a SkyPoint. It makes difference between
0486              * having clicked on the skymap and not having done so
0487              * \note This method is draw-backend independent.
0488             */
0489         void slotBeginAngularDistance();
0490 
0491         void slotBeginStarHop(); // TODO: Add docs
0492 
0493         /** Computes the angular distance, prints the result in the status
0494              * bar and disables the angular distance measuring mode
0495              * If the user has clicked on the map the status bar shows the
0496              * name of the clicked object plus the angular distance. If
0497              * the user did not clicked on the map, just pressed ], only
0498              * the angular distance is printed
0499              * \note This method is draw-backend independent.
0500             */
0501         void slotEndRulerMode();
0502 
0503         /** Disables the angular distance measuring mode. Nothing is printed
0504              * in the status bar */
0505         void slotCancelRulerMode();
0506 
0507         /** @short Open Flag Manager window with clickedObject() RA and Dec entered.
0508               */
0509         void slotAddFlag();
0510 
0511         /** @short Open Flag Manager window with selected flag focused and ready to edit.
0512               *@param flagIdx index of flag to be edited.
0513               */
0514         void slotEditFlag(int flagIdx);
0515 
0516         /** @short Delete selected flag.
0517               *@param flagIdx index of flag to be deleted.
0518               */
0519         void slotDeleteFlag(int flagIdx);
0520 
0521 #ifdef HAVE_OPENGL
0522         void slotToggleGL();
0523 #endif
0524 
0525         /** Run Xplanet Viewer to display images of the planets*/
0526         void slotStartXplanetViewer();
0527 
0528         /** Render eyepiece view */
0529         void slotEyepieceView();
0530 
0531         /** Zoom in one step. */
0532         void slotZoomIn();
0533 
0534         /** Zoom out one step. */
0535         void slotZoomOut();
0536 
0537         /** Set default zoom. */
0538         void slotZoomDefault();
0539 
0540         /** Object pointing for Printing Wizard done */
0541         void slotObjectSelected();
0542 
0543         void slotCancelLegendPreviewMode();
0544 
0545         void slotFinishFovCaptureMode();
0546 
0547         void slotCaptureFov();
0548 
0549     signals:
0550         /** Emitted by setDestination(), and connected to slewFocus().  Whenever the Destination
0551              * point is changed, slewFocus() will iteratively step the Focus toward Destination
0552              * until it is reached.
0553              * @see SkyMap::setDestination()
0554              * @see SkyMap::slewFocus()
0555              */
0556         void destinationChanged();
0557 
0558         /** Emitted when zoom level is changed. */
0559         void zoomChanged();
0560 
0561         /** Emitted when current object changed. */
0562         void objectChanged(SkyObject *);
0563 
0564         /** Emitted when pointing changed. (At least should) */
0565         void positionChanged(SkyPoint *);
0566 
0567         /** Emitted when position under mouse changed. */
0568         void mousePointChanged(SkyPoint *);
0569 
0570         /** Emitted when a position is clicked */
0571         void positionClicked(SkyPoint *);
0572 
0573         /** Emitted when a position is clicked */
0574         void objectClicked(SkyObject *);
0575 
0576         /** Emitted when a sky object is removed from the database */
0577         void removeSkyObject(SkyObject *object);
0578 
0579         /** Emitter when mosaic center is dragged in the sky map */
0580         void mosaicCenterChanged(dms dRA, dms dDE);
0581 
0582         void updateQueued();
0583 
0584     protected:
0585         bool event(QEvent *event) override;
0586 
0587         /** Process keystrokes:
0588              * @li arrow keys  Slew the map
0589              * @li +/- keys  Zoom in and out
0590              * @li <i>Space</i>  Toggle between Horizontal and Equatorial coordinate systems
0591              * @li 0-9  Go to a major Solar System body (0=Sun; 1-9 are the major planets, except 3=Moon)
0592              * @li [  Place starting point for measuring an angular distance
0593              * @li ]  End point for Angular Distance; display measurement.
0594              * @li <i>Escape</i>  Cancel Angular measurement
0595              * @li ,/<  Step backward one time step
0596              * @li ./>  Step forward one time step
0597              */
0598         void keyPressEvent(QKeyEvent *e) override;
0599 
0600         /** When keyRelease is triggered, just set the "slewing" flag to false,
0601              * and update the display (to draw objects that are hidden when slewing==true). */
0602         void keyReleaseEvent(QKeyEvent *e) override;
0603 
0604         /** Determine RA, Dec coordinates of clicked location.  Find the SkyObject
0605              * which is nearest to the clicked location.
0606              *
0607              * If left-clicked: Set set mouseButtonDown==true, slewing==true; display
0608              * nearest object name in status bar.
0609              * If right-clicked: display popup menu appropriate for nearest object.
0610              */
0611         void mousePressEvent(QMouseEvent *e) override;
0612 
0613         /** set mouseButtonDown==false, slewing==false */
0614         void mouseReleaseEvent(QMouseEvent *e) override;
0615 
0616         /** Center SkyMap at double-clicked location  */
0617         void mouseDoubleClickEvent(QMouseEvent *e) override;
0618 
0619         /** This function does several different things depending on the state of the program:
0620              * @li If Angle-measurement mode is active, update the end-ruler point to the mouse cursor,
0621              *     and continue this function.
0622              * @li If we are defining a ZoomBox, update the ZoomBox rectangle, redraw the screen,
0623              *     and return.
0624              * @li If dragging the mouse in the map, update focus such that RA, Dec under the mouse
0625              *     cursor remains constant.
0626              * @li If just moving the mouse, simply update the curso coordinates in the status bar.
0627              */
0628         void mouseMoveEvent(QMouseEvent *e) override;
0629 
0630         /** Zoom in and out with the mouse wheel. */
0631         void wheelEvent(QWheelEvent *e) override;
0632 
0633         /** If the skymap will be resized, the sky must be new computed. So this
0634              * function calls explicitly new computing of the skymap.
0635              */
0636         void resizeEvent(QResizeEvent *) override;
0637 
0638     private slots:
0639         /** @short display tooltip for object under cursor. It's called by m_HoverTimer.
0640              *  if mouse didn't moved for last HOVER_INTERVAL milliseconds.
0641              */
0642         void slotTransientLabel();
0643 
0644         /** Set the shape of mouse cursor to a cross with 4 arrows. */
0645         void setMouseMoveCursor();
0646 
0647         /** Set the shape of mouse cursor to an open hand. */
0648         void setMouseDragCursor();
0649 
0650     private:
0651 
0652         /** @short Sets the shape of the mouse cursor to a magnifying glass. */
0653         void setZoomMouseCursor();
0654 
0655         /** Calculate the zoom factor for the given keyboard modifier
0656              */
0657         double zoomFactor(const int modifier);
0658 
0659         /** calculate the magnitude factor (1, .5, .2, or .1) for the given
0660              * keyboard modifier.
0661              */
0662         double magFactor(const int modifier);
0663 
0664         /** Decrease the magnitude limit by a step size determined by the
0665              * keyboard modifier.
0666              * @param modifier
0667              */
0668         void decMagLimit(const int modifier);
0669 
0670         /** Increase the magnitude limit by a step size determined by the
0671             * keyboard modifier.
0672             * @param modifier
0673             */
0674         void incMagLimit(const int modifier);
0675 
0676         /** Convenience routine to either zoom in or increase mag limit
0677              * depending on the Alt modifier.  The Shift and Control modifiers
0678              * will adjust the size of the zoom or the mag step.
0679              * @param modifier
0680              */
0681         void zoomInOrMagStep(const int modifier);
0682 
0683         /** Convenience routine to either zoom out or decrease mag limit
0684              * depending on the Alt modifier.  The Shift and Control modifiers
0685              * will adjust the size of the zoom or the mag step.
0686              * @param modifier
0687              */
0688         void zoomOutOrMagStep(const int modifier);
0689 
0690         void beginRulerMode(bool starHopRuler); // TODO: Add docs
0691 
0692         /**
0693          * @short Strart xplanet.
0694          * @param outputFile Output file path.
0695          */
0696         void startXplanet(const QString &outputFile = "");
0697 
0698         bool mouseButtonDown { false };
0699         bool midMouseButtonDown { false };
0700         /// True if mouseMoveEvent; needed by setMouseMoveCursor
0701         bool mouseMoveCursor { false };
0702         bool mouseDragCursor { false };
0703         bool slewing { false };
0704         bool clockSlewing { false };
0705         //if false only old pixmap will repainted with bitBlt(), this
0706         // saves a lot of cpu usage
0707         bool computeSkymap { false };
0708         // True if we are either looking for angular distance or star hopping directions
0709         bool rulerMode { false };
0710         // True only if we are looking for star hopping directions. If
0711         // false while rulerMode is true, it means we are measuring angular
0712         // distance. FIXME: Find a better way to do this
0713         bool starHopDefineMode { false };
0714         double y0;
0715 
0716         double m_Scale;
0717 
0718         KStarsData *data { nullptr };
0719         KSPopupMenu *pmenu { nullptr };
0720 
0721         /// Coordinates of point under cursor. It's update in function mouseMoveEvent
0722         SkyPoint m_MousePoint;
0723 
0724         SkyPoint Focus, ClickedPoint, FocusPoint, Destination;
0725         SkyObject *ClickedObject { nullptr };
0726         SkyObject *FocusObject { nullptr };
0727 
0728         Projector *m_proj { nullptr };
0729 
0730         SkyLine AngularRuler; //The line for measuring angles in the map
0731         QRect ZoomRect;       //The manual-focus circle.
0732 
0733         // Mouse should not move for that interval to display tooltip
0734         static const int HOVER_INTERVAL = 500;
0735         // Timer for tooltips
0736         QTimer m_HoverTimer;
0737 
0738         // InfoBoxes. Used in destructor to save state
0739         InfoBoxWidget *m_timeBox { nullptr };
0740         InfoBoxWidget *m_geoBox { nullptr };
0741         InfoBoxWidget *m_objBox { nullptr };
0742         InfoBoxes *m_iboxes { nullptr };
0743 
0744         // legend
0745         bool m_previewLegend { false };
0746         Legend m_legend;
0747 
0748         bool m_objPointingMode { false };
0749         bool m_fovCaptureMode { false };
0750         bool m_touchMode { false };
0751         bool m_pinchMode { false };
0752         bool m_tapAndHoldMode { false };
0753         qreal m_pinchScale { 0.0 };
0754 
0755         QWidget *m_SkyMapDraw { nullptr }; // Can be dynamic_cast<> to SkyMapDrawAbstract
0756 
0757         // NOTE: These are pointers to the individual widgets
0758 #ifdef HAVE_OPENGL
0759         SkyMapQDraw *m_SkyMapQDraw { nullptr };
0760         SkyMapGLDraw *m_SkyMapGLDraw { nullptr };
0761 #endif
0762 
0763         static SkyMap *pinstance;
0764         /// Good to keep the original ruler start-point for purposes of dynamic_cast
0765         const SkyPoint *m_rulerStartPoint { nullptr };
0766 };