Stellarium 0.15.2
LabelMgr.hpp
1 /*
2  * Stellarium
3  * This file Copyright (C) 2008 Matthew Gates
4  * Horizon system labels (c) 2015 Georg Zotti
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
19  */
20 
21 #ifndef _SKYLABELMGR_HPP_
22 #define _SKYLABELMGR_HPP_
23 
24 
25 #include "StelFader.hpp"
26 #include "StelModule.hpp"
27 #include "StelObject.hpp"
28 #include "StelObjectType.hpp"
29 #include "VecMath.hpp"
30 
31 #include <QVector>
32 #include <QString>
33 
34 class StelCore;
35 class StelPainter;
36 
46 class LabelMgr : public StelModule
47 {
48  Q_OBJECT
49 
50 public:
52  LabelMgr();
53  virtual ~LabelMgr();
54 
56  // Methods defined in the StelModule class
58  virtual void init();
59 
61  virtual void draw(StelCore* core);
62 
64  virtual void update(double deltaTime);
65 
67  virtual double getCallOrder(StelModuleActionName actionName) const;
68 
69 public slots:
84  int labelObject(const QString& text,
85  const QString& objectName,
86  bool visible=true,
87  float fontSize=14,
88  const QString& fontColor="#999999",
89  const QString& side="E",
90  double labelDistance=-1.0,
91  const QString& style="TextOnly");
92 
100  int labelHorizon(const QString& text,
101  float az,
102  float alt,
103  bool visible=true,
104  float fontSize=14,
105  const QString& fontColor="#999999");
106 
114  int labelScreen(const QString& text,
115  int x,
116  int y,
117  bool visible=true,
118  float fontSize=14,
119  const QString& fontColor="#999999");
120 
122  bool getLabelShow(int id);
124  void setLabelShow(int id, bool show);
126  void setLabelText(int id, const QString& newText);
129  bool deleteLabel(int id);
132  int deleteAllLabels(void);
133 
134 private:
135  QVector<class StelLabel*> allLabels;
136 };
137 
138 #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:48
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 labelHorizon(const QString &text, float az, float alt, bool visible=true, float fontSize=14, const QString &fontColor="#999999")
Create a label in azimuthal coordinate system.
int deleteAllLabels(void)
Delete all labels.
StelModuleActionName
Define the possible action for which an order is defined.
Definition: StelModule.hpp:121
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:46
This is the common base class for all the main components of stellarium.
Definition: StelModule.hpp:49