File indexing completed on 2024-04-28 03:44:26

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 "skynode.h"
0009 
0010 class PolyNode;
0011 class Satellite;
0012 class PointNode;
0013 class QSGFlatColorMaterial;
0014 class LabelNode;
0015 
0016 /**
0017  * @class SatelliteNode
0018  *
0019  * @short A SkyNode derived class that represents satellite
0020  * @author Artem Fedoskin
0021  * @version 1.0
0022  */
0023 
0024 class SatelliteNode : public SkyNode
0025 {
0026   public:
0027     /**
0028      * @short Constructor.
0029      * @param sat - satellite that is represented by this node
0030      * @param rootNode - pointer to the top parent node
0031      */
0032     SatelliteNode(Satellite *sat, RootNode *rootNode);
0033 
0034     /**
0035      * @short Update position and visibility of satellite.
0036      * We also check user settings (Options::drawSatellitesLikeStars()) and based on that draw satellite
0037      * either like star or with lines
0038      */
0039     virtual void update() override;
0040     virtual void hide() override;
0041 
0042     /**
0043      * @short Initialize m_lines (if not already) to draw satellite with lines
0044      */
0045     void initLines();
0046 
0047     /**
0048      * @short Initialize m_point (if not already) to draw satellite as a star
0049      */
0050     void initPoint();
0051 
0052     virtual void changePos(QPointF pos) override;
0053 
0054     inline Satellite *sat() { return m_sat; }
0055 
0056   private:
0057     Satellite *m_sat;
0058     RootNode *m_rootNode;
0059 
0060     QSGGeometryNode *m_lines { nullptr };
0061 
0062     LabelNode *m_label { nullptr };
0063 
0064     QSGFlatColorMaterial *m_material { nullptr };
0065     QSGGeometry *m_geometry { nullptr };
0066 
0067     PointNode *m_point { nullptr };
0068 };