Stellarium 0.13.3
LabelMgr.hpp
1 /*
2  * Stellarium
3  * This file Copyright (C) 2008 Matthew Gates
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18  */
19 
20 #ifndef _SKYLABELMGR_HPP_
21 #define _SKYLABELMGR_HPP_
22 
23 
24 #include "StelFader.hpp"
25 #include "StelModule.hpp"
26 #include "StelObject.hpp"
27 #include "StelObjectType.hpp"
28 #include "VecMath.hpp"
29 
30 #include <QVector>
31 #include <QString>
32 
33 class StelCore;
34 class StelPainter;
35 
44 class LabelMgr : public StelModule
45 {
46  Q_OBJECT
47 
48 public:
50  LabelMgr();
51  virtual ~LabelMgr();
52 
54  // Methods defined in the StelModule class
56  virtual void init();
57 
59  virtual void draw(StelCore* core);
60 
62  virtual void update(double deltaTime);
63 
65  virtual double getCallOrder(StelModuleActionName actionName) const;
66 
67 public slots:
82  int labelObject(const QString& text,
83  const QString& objectName,
84  bool visible=true,
85  float fontSize=14,
86  const QString& fontColor="#999999",
87  const QString& side="E",
88  double labelDistance=-1.0,
89  const QString& style="TextOnly");
90 
98  int labelScreen(const QString& text,
99  int x,
100  int y,
101  bool visible=true,
102  float fontSize=14,
103  const QString& fontColor="#999999");
104 
106  bool getLabelShow(int id);
108  void setLabelShow(int id, bool show);
110  void setLabelText(int id, const QString& newText);
113  bool deleteLabel(int id);
116  int deleteAllLabels(void);
117 
118 private:
119  QVector<class StelLabel*> allLabels;
120 };
121 
122 #endif // _SKYLABELMGR_HPP_
int labelObject(const QString &text, const QString &objectName, bool visible=true, float fontSize=14, const QString &fontColor="#999999", const QString &side="E", double labelDistance=-1.0, const QString &style="TextOnly")
Create a label which is attached to a StelObject.
bool deleteLabel(int id)
Delete a label by the ID which was returned from addLabel...
virtual void update(double deltaTime)
Update time-dependent parts of the module.
void setLabelText(int id, const QString &newText)
set text of label identified by id to be newText
void setLabelShow(int id, bool show)
set a label identified by id to be shown or not
Main class for Stellarium core processing.
Definition: StelCore.hpp:46
virtual double getCallOrder(StelModuleActionName actionName) const
Defines the order in which the various modules are drawn.
virtual void draw(StelCore *core)
Draw user labels.
Define the StelObjectP type.
Provides functions for performing openGL drawing operations.
Definition: StelPainter.hpp:40
bool getLabelShow(int id)
find out if a label identified by id is presently shown
int deleteAllLabels(void)
Delete all labels.
StelModuleActionName
Define the possible action for which an order is defined.
Definition: StelModule.hpp:117
LabelMgr()
Construct a LabelMgr object.
int labelScreen(const QString &text, int x, int y, bool visible=true, float fontSize=14, const QString &fontColor="#999999")
Create a label at fixed screen coordinates.
virtual void init()
Initialize the LabelMgr object.
Allows for creation of custom labels on objects or coordinates.
Definition: LabelMgr.hpp:44
This is the common base class for all the main components of stellarium.
Definition: StelModule.hpp:49