File indexing completed on 2024-04-21 03:44:16

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 #include "../labelsitem.h"
0010 
0011 #include <QSGSimpleRectNode>
0012 
0013 class PlanetItemNode;
0014 class PointNode;
0015 class QSGSimpleTextureNode;
0016 class RootNode;
0017 class SkyLabeler;
0018 class SkyMapLite;
0019 
0020 /**
0021  * @class GuideLabelNode
0022  * Currently this class is not used anywhere.
0023  *
0024  * @author Artem Fedoskin
0025  * @version 1.0
0026  */
0027 class GuideLabelNode : public SkyNode
0028 {
0029   public:
0030     /**
0031      * @short Constructor
0032      * @param name name of the guide label
0033      * @param type type of the label item
0034      */
0035     GuideLabelNode(QString name, LabelsItem::label_t type);
0036 
0037     /**
0038      * @short changePos changes the position m_point
0039      * @param pos new position
0040      */
0041     virtual void changePos(QPointF pos) override;
0042 
0043     /**
0044      * @short setLabelPos sets the position of label with the given offset from SkyObject's position and
0045      * makes the label visible if it was hidden
0046      * @param pos position of label
0047      * @param angle label angle
0048      */
0049     void setLabelPos(QPointF pos, float angle);
0050 
0051     virtual void update() override;
0052 
0053     inline const QString name() const { return m_name; }
0054 
0055     QPointF labelPos;
0056     qreal left { 0 };
0057     qreal right { 0 };
0058     qreal top { 0 };
0059     qreal bot { 0 };
0060 
0061   private:
0062     QSGSimpleTextureNode *m_textTexture { nullptr };
0063     QSize m_textSize { 0, 0 };
0064     float m_angle { 0 };
0065     QSGSimpleRectNode debugRect;
0066     const QString m_name;
0067     QPointF m_translatePos;
0068 };