File indexing completed on 2024-11-10 03:30:31

0001 /*
0002     SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #pragma once
0007 
0008 #include "skyobjects/skypoint.h"
0009 #include "skyobjects/skyline.h"
0010 
0011 #include <QTimer>
0012 #include <QPainter>
0013 
0014 #include <config-kstars.h>
0015 #include <QQuickItem>
0016 #include <QPolygonF>
0017 #include <QLinkedList>
0018 #include "kstarsdata.h"
0019 #include "kstarslite/skyitems/rootnode.h"
0020 
0021 #include <basedevice.h>
0022 
0023 class DeviceOrientation;
0024 
0025 class dms;
0026 class KStarsData;
0027 class SkyObject;
0028 class Projector;
0029 class SolarSystemSingleComponent;
0030 class PlanetsItem;
0031 class AsteroidsItem;
0032 class CometsItem;
0033 class PlanetMoonsComponent;
0034 class HorizonItem;
0035 class LinesItem;
0036 class SkyNode;
0037 class RootNode;
0038 class TelescopeLite;
0039 
0040 class SkyObjectLite;
0041 class SkyPointLite;
0042 
0043 class QSGTexture;
0044 
0045 /** @class SkyMapLite
0046 *
0047 *This is the main item that displays all SkyItems. After its instantiation it is reparanted
0048 *to an object with objectName SkyMapLiteWrapper in main.qml. To display SkyItems they are reparanted
0049 *to instance of SkyMapLite.
0050 *
0051 *SkyMapLite handles most user interaction events (both mouse and keyboard).
0052 *
0053 *@short Item for displaying sky objects; also handles user interaction events.
0054 *@author Artem Fedoskin
0055 *@version 1.0
0056 */
0057 
0058 class SkyMapLite : public QQuickItem
0059 {
0060         Q_OBJECT
0061         /** magnitude limit. Used in QML **/
0062         Q_PROPERTY(double magLim READ getMagLim WRITE setMagLim NOTIFY magLimChanged)
0063 
0064         /** wrappers for clickedPoint and clickedObject. Used to set clicked object and point from QML **/
0065         Q_PROPERTY(SkyPointLite *clickedPointLite READ getClickedPointLite NOTIFY pointLiteChanged)
0066         Q_PROPERTY(SkyObjectLite *clickedObjectLite READ getClickedObjectLite NOTIFY objectLiteChanged)
0067         /** list of FOVSymbols that are currently available **/
0068         Q_PROPERTY(QStringList FOVSymbols READ getFOVSymbols NOTIFY symbolsFOVChanged)
0069         /** true if SkyMapLite is being panned **/
0070         Q_PROPERTY(bool slewing READ getSlewing WRITE setSlewing NOTIFY slewingChanged)
0071         /**
0072              * @short true if SkyMapLite is centered on an object and only pinch-to-zoom needs to be available
0073             **/
0074         Q_PROPERTY(bool centerLocked READ getCenterLocked WRITE setCenterLocked NOTIFY centerLockedChanged)
0075         Q_PROPERTY(bool automaticMode READ getAutomaticMode WRITE setAutomaticMode NOTIFY automaticModeChanged)
0076         Q_PROPERTY(double skyRotation READ getSkyRotation WRITE setSkyRotation NOTIFY skyRotationChanged)
0077 
0078         enum class SkyMapOrientation
0079         {
0080             Top0,
0081             Right90,
0082             Bottom180,
0083             Left270
0084         };
0085 
0086     protected:
0087         SkyMapLite();
0088 
0089         /** Updates SkyMapLite by calling RootNode::update(), which in turn initiates update of all child nodes. **/
0090         virtual QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData) override;
0091 
0092     public:
0093         /** Creates instance of SkyMapLite (delete the old one if any) **/
0094         static SkyMapLite *createInstance();
0095 
0096         /** Bind size to parent's size and initialize star images **/
0097         void initialize(QQuickItem *parent);
0098 
0099         static SkyMapLite *Instance()
0100         {
0101             return pinstance;
0102         }
0103 
0104         static bool IsSlewing()
0105         {
0106             return pinstance->isSlewing();
0107         }
0108 
0109         /** Destructor. Clear star images.*/
0110         ~SkyMapLite();
0111 
0112         /**
0113              * @short skyNode will be deleted on the next call to updatePaintNode (currently used only in
0114              * StarNode(struct in StarBlock))
0115              */
0116         void deleteSkyNode(SkyNode *skyNode);
0117 
0118         /** @short Update the focus position according to current options. */
0119         void updateFocus();
0120 
0121         /** @short Retrieve the Focus point; the position on the sky at the
0122              *center of the skymap.
0123              *@return a pointer to the central focus point of the sky map
0124              */
0125         SkyPoint *focus()
0126         {
0127             return &Focus;
0128         }
0129 
0130         /** @short retrieve the Destination position.
0131              *
0132              *The Destination is the point on the sky to which the focus will be moved.
0133              *@return a pointer to the destination point of the sky map
0134              */
0135         SkyPoint *destination()
0136         {
0137             return &Destination;
0138         }
0139 
0140         /** @short retrieve the FocusPoint position.
0141              *
0142              *The FocusPoint stores the position on the sky that is to be
0143              *focused next.  This is not exactly the same as the Destination
0144              *point, because when the Destination is set, it will begin slewing
0145              *immediately.
0146              *
0147              *@return a pointer to the sky point which is to be focused next.
0148              */
0149         SkyPoint *focusPoint()
0150         {
0151             return &FocusPoint;
0152         }
0153 
0154         /** @short sets the central focus point of the sky map.
0155              *@param f a pointer to the SkyPoint the map should be centered on
0156              */
0157         void setFocus(SkyPoint *f);
0158 
0159         /** @short sets the focus point of the skymap, using ra/dec coordinates
0160              *
0161              *@note This function behaves essentially like the above function.
0162              *It differs only in the data types of its arguments.
0163              *
0164              *@param ra the new right ascension
0165              *@param dec the new declination
0166              */
0167         void setFocus(const dms &ra, const dms &dec);
0168 
0169         /** @short sets the focus point of the sky map, using its alt/az coordinates
0170              *@param alt the new altitude (actual, i.e. without refraction correction)
0171              *@param az the new azimuth
0172              */
0173         void setFocusAltAz(const dms &alt, const dms &az);
0174 
0175         /** @short sets the destination point of the sky map.
0176              *@note setDestination() emits the destinationChanged() SIGNAL,
0177              *which triggers the SLOT function SkyMap::slewFocus().  This
0178              *function iteratively steps the Focus point toward Destination,
0179              *repainting the sky at each step (if Options::useAnimatedSlewing()==true).
0180              *@param f a pointer to the SkyPoint the map should slew to
0181              */
0182         void setDestination(const SkyPoint &f);
0183 
0184         /** @short sets the destination point of the skymap, using ra/dec coordinates.
0185              *
0186              *@note This function behaves essentially like the above function.
0187              *It differs only in the data types of its arguments.
0188              *
0189              *@param ra the new right ascension
0190              *@param dec the new declination
0191              */
0192         void setDestination(const dms &ra, const dms &dec);
0193 
0194         /** @short sets the destination point of the sky map, using its alt/az coordinates.
0195              *@param alt the new altitude
0196              *@param az the new azimuth
0197              *@param altIsRefracted set to true if the altitude supplied is apparent
0198              */
0199         void setDestinationAltAz(const dms &alt, const dms &az, bool altIsRefracted);
0200 
0201         /** @short set the FocusPoint; the position that is to be the next Destination.
0202              *@param f a pointer to the FocusPoint SkyPoint.
0203              */
0204         void setFocusPoint(SkyPoint *f)
0205         {
0206             if (f)
0207                 FocusPoint = *f;
0208         }
0209 
0210         /** @short Retrieve the ClickedPoint position.
0211              *
0212              *When the user clicks on a point in the sky map, the sky coordinates of the mouse
0213              *cursor are stored in the private member ClickedPoint.  This function retrieves
0214              *a pointer to ClickedPoint.
0215              *@return a pointer to ClickedPoint, the sky coordinates where the user clicked.
0216              */
0217         SkyPoint *clickedPoint()
0218         {
0219             return &ClickedPoint;
0220         }
0221 
0222         /** @short Set the ClickedPoint to the skypoint given as an argument.
0223              *@param f pointer to the new ClickedPoint.
0224              */
0225         void setClickedPoint(SkyPoint *f);
0226 
0227         /** @short Retrieve the object nearest to a mouse click event.
0228              *
0229              *If the user clicks on the sky map, a pointer to the nearest SkyObject is stored in
0230              *the private member ClickedObject.  This function returns the ClickedObject pointer,
0231              *or nullptr if there is no CLickedObject.
0232              *@return a pointer to the object nearest to a user mouse click.
0233              */
0234         SkyObject *clickedObject() const
0235         {
0236             return ClickedObject;
0237         }
0238 
0239         /** @short Set the ClickedObject pointer to the argument.
0240              *@param o pointer to the SkyObject to be assigned as the ClickedObject
0241              */
0242         void setClickedObject(SkyObject *o);
0243 
0244         /** @short Retrieve the object which is centered in the sky map.
0245              *
0246              *If the user centers the sky map on an object (by double-clicking or using the
0247              *Find Object dialog), a pointer to the "focused" object is stored in
0248              *the private member FocusObject.  This function returns a pointer to the
0249              *FocusObject, or nullptr if there is not FocusObject.
0250              *@return a pointer to the object at the center of the sky map.
0251              */
0252         SkyObject *focusObject() const
0253         {
0254             return FocusObject;
0255         }
0256 
0257         /** @short Set the FocusObject pointer to the argument.
0258              *@param o pointer to the SkyObject to be assigned as the FocusObject
0259              */
0260         void setFocusObject(SkyObject *o);
0261 
0262         /** @ Set zoom factor.
0263              *@param factor zoom factor
0264              */
0265         void setZoomFactor(double factor);
0266 
0267         /** @short Call to set up the projector before update of SkyItems positions begins. */
0268         void setupProjector();
0269 
0270         /** @short Returns index for a Harvard spectral classification */
0271         int harvardToIndex(char c);
0272 
0273         /** @short returns cache of star images
0274              *  @return star images cache
0275              */
0276         QVector<QVector<QPixmap *>> getImageCache();
0277 
0278         /**
0279              * @short creates QImage from text and converts it to QSGTexture
0280              * @param text the text string
0281              * @param color text color
0282              * @param zoomFont if true zoom-dependent font from SkyLabeler will be used else standart
0283              * font is used
0284              * @return QSGTexture with text
0285              * @note font size is set in SkyLabeler::SkyLabeler() by initializing m_stdFont with default font
0286              */
0287         QSGTexture *textToTexture(QString text, QColor color = QColor(255, 255, 255), bool zoomFont = false);
0288 
0289         /**
0290              * @short returns cached texture from textureCache.
0291              *
0292              * Use outside of scene graph rendering thread (e.g. not during call to updatePaintNode)
0293              * is prohibited!
0294              * @param size size of the star
0295              * @param spType spectral class
0296              * @return cached QSGTexture from textureCache
0297              */
0298         QSGTexture *getCachedTexture(int size, char spType);
0299 
0300         /** @short called when SkyMapComposite finished loading all SkyComponents */
0301         inline void loadingFinished()
0302         {
0303             m_loadingFinished = true;
0304         }
0305 
0306         /** @return true if the map is in slewing mode or clock is active **/
0307         bool isSlewing() const;
0308 
0309         /** @return current magnitude limit **/
0310         inline double getMagLim()
0311         {
0312             return m_magLim;
0313         }
0314 
0315         /** @short set magnitude limit **/
0316         void setMagLim(double magLim);
0317 
0318         /** @short Convenience function for shutting off tracking mode.  Just calls KStars::slotTrack() **/
0319         void stopTracking();
0320 
0321         /** Get the current projector.
0322                 @return a pointer to the current projector. */
0323         inline const Projector *projector() const
0324         {
0325             return m_proj;
0326         }
0327 
0328         /**
0329              * @short used in QML
0330              * @return type of current projection system
0331              */
0332         Q_INVOKABLE uint projType() const;
0333 
0334         /** Set magnitude limit for size of stars. Used in StarItem **/
0335         inline void setSizeMagLim(float sizeMagLim)
0336         {
0337             m_sizeMagLim = sizeMagLim;
0338         }
0339 
0340         /** Used in PointSourceNode **/
0341         inline float sizeMagLim() const
0342         {
0343             return m_sizeMagLim;
0344         }
0345 
0346         static inline RootNode *rootNode()
0347         {
0348             return m_rootNode;
0349         }
0350 
0351         static inline void setRootNode(RootNode *root)
0352         {
0353             m_rootNode = root;
0354         }
0355 
0356         /** return limit of hides for the node to delete it **/
0357         static double deleteLimit();
0358 
0359         /**
0360              * @short adds FOV symbol to m_FOVSymbols
0361              * @param FOVName name of a FOV symbol
0362              * @param initialState defines whether the state is initial
0363              */
0364         Q_INVOKABLE void addFOVSymbol(const QString &FOVName, bool initialState = false);
0365 
0366         /**
0367              * @param index of FOVSymbol in m_FOVSymbols
0368              * @return true if FOV symbol with name FOVName should be drawn.
0369              */
0370         bool isFOVVisible(int index);
0371 
0372         /**
0373               * @param index of FOVSymbol in m_FOVSymbols
0374               * @param visible defines whether the FOV symbol should be visible
0375               * @short updates visibility of FOV symbol according to visible
0376               */
0377         Q_INVOKABLE void setFOVVisible(int index, bool visible);
0378 
0379         /**
0380               * @short this QList should be used as a model in QML to switch on/off FOV symbols
0381               **/
0382         Q_INVOKABLE inline QStringList getFOVSymbols()
0383         {
0384             return m_FOVSymbols;
0385         }
0386 
0387         /** @short Initializes images of Stars and puts them in cache (copied from SkyQPainter)*/
0388         void initStarImages();
0389 
0390         /**
0391              * @short getter for clickedPointLite
0392              */
0393         SkyPointLite *getClickedPointLite()
0394         {
0395             return m_ClickedPointLite;
0396         }
0397 
0398         /**
0399              * @short getter for clickedObjectLite
0400              */
0401         SkyObjectLite *getClickedObjectLite()
0402         {
0403             return m_ClickedObjectLite;
0404         }
0405 
0406         /**
0407              * @short getter for centerLocked
0408              */
0409         bool getCenterLocked()
0410         {
0411             return m_centerLocked;
0412         }
0413 
0414         /**
0415              * @short Proxy method for SkyMapDrawAbstract::drawObjectLabels()
0416              */
0417         //inline void drawObjectLabels( QList< SkyObject* >& labelObjects ) { dynamic_cast<SkyMapDrawAbstract *>(m_SkyMapDraw)->drawObjectLabels( labelObjects ); }
0418 
0419         /**
0420              * @return true if SkyMapLite is being slewed
0421              */
0422         bool getSlewing() const
0423         {
0424             return m_slewing;
0425         }
0426 
0427         /**
0428              * @short sets whether SkyMapLite is being slewed
0429              */
0430         void setSlewing(bool newSlewing);
0431 
0432         /**
0433              * @short sets whether SkyMapLite is centered on an object and locked(olny pinch-to-zoom is available)
0434              */
0435         void setCenterLocked(bool centerLocked);
0436 
0437         /** True if automatic mode is on (SkyMapLite is controlled by smartphones accelerometer magnetometer) **/
0438         bool getAutomaticMode() const
0439         {
0440             return m_automaticMode;
0441         }
0442 
0443         /**
0444              * @short switch automatic mode on/off according to isOn parameter
0445              */
0446         Q_INVOKABLE void setAutomaticMode(bool automaticMode);
0447 
0448         double getSkyRotation() const
0449         {
0450             return m_skyRotation;
0451         }
0452 
0453     public slots:
0454         /** Called whenever wrappers' width or height are changed. Probably will be used to
0455             * update positions of items.
0456             */
0457         void resizeItem();
0458 
0459         /** Recalculates the positions of objects in the sky, and then repaints the sky map.
0460              */
0461         void forceUpdate();
0462 
0463         /** @short Left for compatibility reasons
0464              * @see forceUpdate()
0465              */
0466         void forceUpdateNow()
0467         {
0468             forceUpdate();
0469         }
0470 
0471         /**
0472              * @short Update the focus point and call forceUpdate()
0473              * @param now is saved for compatibility reasons
0474              */
0475         void slotUpdateSky(bool now);
0476 
0477         /** Step the Focus point toward the Destination point.  Do this iteratively, redrawing the Sky
0478              * Map after each step, until the Focus point is within 1 step of the Destination point.
0479              * For the final step, snap directly to Destination, and redraw the map.
0480              */
0481         void slewFocus();
0482 
0483         /** @short Center the display at the point ClickedPoint.
0484              *
0485              * The essential part of the function is to simply set the Destination point, which will emit
0486              * the destinationChanged() SIGNAL, which triggers the slewFocus() SLOT.  Additionally, this
0487              * function performs some bookkeeping tasks, such updating whether we are tracking the new
0488              * object/position, adding a Planet Trail if required, etc.
0489              *
0490              * @see destinationChanged()
0491              * @see slewFocus()
0492              */
0493         void slotCenter();
0494 
0495         /** Checks whether the timestep exceeds a threshold value.  If so, sets
0496              * ClockSlewing=true and sets the SimClock to ManualMode.
0497              */
0498         void slotClockSlewing();
0499 
0500         /** Zoom in one step. */
0501         void slotZoomIn();
0502 
0503         /** Zoom out one step. */
0504         void slotZoomOut();
0505 
0506         /** Set default zoom. */
0507         void slotZoomDefault();
0508         /**
0509              * @short centres skyObj in SkyMap and opens context drawer with skyObj
0510              * Used in FindDialogLite
0511              */
0512         void slotSelectObject(SkyObject *skyObj);
0513 
0514         /** @short updates focus of SkyMapLite according to data from DeviceOrientation
0515                 (Smartphone's sensors)*/
0516         void updateAutomaticMode();
0517 
0518         void setSkyRotation(double skyRotation);
0519 
0520     signals:
0521         /** Emitted by setDestination(), and connected to slewFocus().  Whenever the Destination
0522              * point is changed, slewFocus() will iteratively step the Focus toward Destination
0523              * until it is reached.
0524              * @see SkyMap::setDestination()
0525              * @see SkyMap::slewFocus()
0526              */
0527         void destinationChanged();
0528 
0529         /** Emitted when zoom level is changed. */
0530         void zoomChanged();
0531 
0532         /** Emitted when current object changed. */
0533         void objectChanged();
0534 
0535         /** Wrapper of ClickedObject for QML **/
0536         void objectLiteChanged();
0537 
0538         /** Wrapper of ClickedPoint for QML **/
0539         void pointLiteChanged();
0540 
0541         /** Emitted when pointing changed. (At least should) */
0542         void positionChanged();
0543 
0544         /** Emitted when position under mouse changed. */
0545         void mousePointChanged(SkyPoint *);
0546 
0547         /** Emitted when a position is clicked */
0548         void positionClicked(SkyPoint *);
0549 
0550         /** Emitted when user clicks on SkyMapLite (analogous to positionClicked but sends QPoint) */
0551         void posClicked(QPointF pos);
0552 
0553         /** Emitted when magnitude limit is changed */
0554         void magLimChanged(double magLim);
0555 
0556         /** Emitted when FOVSymbols list was changed (new value appended) **/
0557         void symbolsFOVChanged(QStringList);
0558 
0559         /** Emitted when SkyMapLite is being slewed or slewing is finished **/
0560         void slewingChanged(bool);
0561 
0562         void centerLockedChanged(bool);
0563 
0564         void automaticModeChanged(bool);
0565 
0566         /** Emitted when skyRotation used to rotate coordinates of SkyPoints is changed **/
0567         void skyRotationChanged(double skyRotation);
0568 
0569     protected:
0570         /** Process keystrokes:
0571              * @li arrow keys  Slew the map
0572              * @li +/- keys  Zoom in and out
0573              * @li <i>Space</i>  Toggle between Horizontal and Equatorial coordinate systems
0574              * @li 0-9  Go to a major Solar System body (0=Sun; 1-9 are the major planets, except 3=Moon)
0575              * @li [  Place starting point for measuring an angular distance
0576              * @li ]  End point for Angular Distance; display measurement.
0577              * @li <i>Escape</i>  Cancel Angular measurement
0578              * @li ,/<  Step backward one time step
0579              * @li ./>  Step forward one time step
0580              */
0581         //virtual void keyPressEvent( QKeyEvent *e );
0582 
0583         /** When keyRelease is triggered, just set the "slewing" flag to false,
0584              * and update the display (to draw objects that are hidden when slewing==true). */
0585         //virtual void keyReleaseEvent( QKeyEvent *e );
0586 
0587         /** Determine RA, Dec coordinates of clicked location.  Find the SkyObject
0588              * which is nearest to the clicked location.
0589              *
0590              * If left-clicked: Set set mouseButtonDown==true, slewing==true; display
0591              * nearest object name in status bar.
0592              * If right-clicked: display popup menu appropriate for nearest object.
0593              */
0594         virtual void mousePressEvent(QMouseEvent *e) override;
0595 
0596         /** set mouseButtonDown==false, slewing==false */
0597         virtual void mouseReleaseEvent(QMouseEvent *e) override;
0598 
0599         /** Center SkyMap at double-clicked location  */
0600         virtual void mouseDoubleClickEvent(QMouseEvent *e) override;
0601 
0602         /** This function does several different things depending on the state of the program:
0603              * @li If Angle-measurement mode is active, update the end-ruler point to the mouse cursor,
0604              *     and continue this function.
0605              * @li If we are defining a ZoomBox, update the ZoomBox rectangle, redraw the screen,
0606              *     and return.
0607              * @li If dragging the mouse in the map, update focus such that RA, Dec under the mouse
0608              *     cursor remains constant.
0609              * @li If just moving the mouse, simply update the curso coordinates in the status bar.
0610              */
0611         virtual void mouseMoveEvent(QMouseEvent *e) override;
0612 
0613         /** Zoom in and out with the mouse wheel. */
0614         virtual void wheelEvent(QWheelEvent *e) override;
0615 
0616         /**
0617              * @short this function handles zooming in and out using "pinch to zoom" gesture
0618              */
0619         virtual void touchEvent(QTouchEvent *e) override;
0620 
0621     private slots:
0622         /** @short display tooltip for object under cursor. It's called by m_HoverTimer.
0623              *  if mouse didn't moved for last HOVER_INTERVAL milliseconds.
0624              */
0625         //void slotTransientLabel();
0626 
0627         /** Set the shape of mouse cursor to a cross with 4 arrows. */
0628         void setMouseMoveCursor();
0629 
0630     private:
0631         /** @short Sets the shape of the default mouse cursor to a cross. */
0632         void setDefaultMouseCursor();
0633 
0634         /** @short Sets the shape of the mouse cursor to a magnifying glass. */
0635         void setZoomMouseCursor();
0636 
0637         /** Calculate the zoom factor for the given keyboard modifier
0638              */
0639         double zoomFactor(const int modifier);
0640 
0641         /** calculate the magnitude factor (1, .5, .2, or .1) for the given
0642              * keyboard modifier.
0643              */
0644         double magFactor(const int modifier);
0645 
0646         /** Decrease the magnitude limit by a step size determined by the
0647              * keyboard modifier.
0648              * @param modifier
0649              */
0650         void decMagLimit(const int modifier);
0651 
0652         /** Increase the magnitude limit by a step size determined by the
0653             * keyboard modifier.
0654             * @param modifier
0655             */
0656         void incMagLimit(const int modifier);
0657 
0658         /** Convenience routine to either zoom in or increase mag limit
0659              * depending on the Alt modifier.  The Shift and Control modifiers
0660              * will adjust the size of the zoom or the mag step.
0661              * @param modifier
0662              */
0663         void zoomInOrMagStep(const int modifier);
0664 
0665         /** Convenience routine to either zoom out or decrease mag limit
0666              * depending on the Alt modifier.  The Shift and Control modifiers
0667              * will adjust the size of the zoom or the mag step.
0668              * @param modifier
0669              */
0670         void zoomOutOrMagStep(const int modifier);
0671 
0672         /**
0673          * pointer to RootNode. Use it to universally access RootNode
0674          * @warning RootNode should be used solely during updatePaintNode! See Qt Quick Scene Graph documentation.
0675          **/
0676         static RootNode *m_rootNode;
0677         static SkyMapLite *pinstance;
0678         static int starColorMode;
0679 
0680         /// True if SkyMapLite was initialized (star images were initialized etc.)
0681         bool isInitialized { false };
0682         bool mouseButtonDown { false };
0683         bool midMouseButtonDown { false };
0684         /// True if mouseMoveEvent; needed by setMouseMoveCursor
0685         bool mouseMoveCursor { false };
0686         bool m_slewing { false };
0687         bool clockSlewing { false };
0688         /// True if pinch to zoom or pinch to rotate is performed
0689         bool pinch { false };
0690         /// If false only old pixmap will repainted with bitBlt() to save a lot of CPU usage
0691         bool computeSkymap { false };
0692         double y0 { 0 };
0693         int count { 0 };
0694         KStarsData *data { nullptr };
0695         /// True if SkyMapComposite has finished loading of SkyComponents
0696         bool m_loadingFinished { false };
0697         /// Coordinates of point under cursor. It's update in function mouseMoveEvent
0698         SkyPoint m_MousePoint;
0699         SkyPoint Focus, ClickedPoint, FocusPoint, Destination;
0700         SkyObject *ClickedObject { nullptr };
0701         SkyObject *FocusObject { nullptr };
0702         SkyPointLite *m_ClickedPointLite { nullptr };
0703         SkyObjectLite *m_ClickedObjectLite { nullptr };
0704         bool m_centerLocked { false };
0705         //SkyLine AngularRuler; //The line for measuring angles in the map
0706         QRect ZoomRect; //The manual-focus circle.
0707         /// Mouse should not move for that interval to display tooltip
0708         static const int HOVER_INTERVAL = 500;
0709         /// Timer for tooltips
0710         QTimer m_HoverTimer;
0711         bool m_objPointingMode { false };
0712         bool m_fovCaptureMode { false };
0713         Projector *m_proj { nullptr };
0714         QQuickItem *m_SkyMapLiteWrapper { nullptr };
0715         /// Holds SkyNodes that need to be deleted
0716         QLinkedList<SkyNode *> m_deleteNodes;
0717         /// Used in PointSourceNode
0718         float m_sizeMagLim { 10 };
0719         /// Mag limit for all objects
0720         double m_magLim { 0 };
0721         /// Used to notify zoom-dependent labels about font size change
0722         bool m_fontSizeChanged { false };
0723         /// Used for drawing labels
0724         QPainter m_painter;
0725         /**
0726          * This timer is triggered every time user touches the screen with one finger.
0727          * If touch was released within 500 milliseconds than it is a tap, otherwise we pan.
0728          **/
0729         QTimer m_tapBeganTimer;
0730         /// Good to keep the original ruler start-point for purposes of dynamic_cast
0731         const SkyPoint *m_rulerStartPoint;
0732         QStringList m_FOVSymbols;
0733         QList<bool> m_FOVSymVisible;
0734         /// Total number of sizes of stars.
0735         const int nStarSizes { 15 };
0736         /// Total number of spectral classes (N.B. Must be in sync with harvardToIndex)
0737         const int nSPclasses { 7 };
0738         /// Cache for star images.
0739         QVector<QVector<QPixmap *>> imageCache;
0740         /// Textures created from cached star images
0741         QVector<QVector<QSGTexture *>> textureCache;
0742         bool clearTextures { false };
0743         bool tapBegan { false };
0744         QList<INDI::BaseDevice *> m_newTelescopes;
0745         QList<INDI::BaseDevice *> m_delTelescopes;
0746         bool m_automaticMode { false };
0747         double m_skyRotation { 0 };
0748         SkyMapOrientation m_skyMapOrientation { SkyMapOrientation::Top0 };
0749 #if defined(Q_OS_ANDROID)
0750         QTimer automaticModeTimer;
0751         DeviceOrientation *m_deviceOrientation { nullptr };
0752 #endif
0753 };