3
* This file Copyright (C) 2008 Matthew Gates
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.
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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
#ifndef _SKYLABELMGR_HPP_
21
#define _SKYLABELMGR_HPP_
24
#include "StelFader.hpp"
25
#include "StelModule.hpp"
26
#include "StelObject.hpp"
27
#include "StelObjectType.hpp"
28
#include "VecMath.hpp"
38
//! Allows for creation of custom labels on objects or coordinates.
39
//! Because this class is intended for use in scripting (although
40
//! other uses are also fine), all label types and so on are specified
41
//! by QString descriptions.
42
//! TODO: when QT4.5 is out, change implementation to use QGraphicsTextItem.
43
//! (QT4.5 should allow for opacity changes for fades, but it is not currently
45
class LabelMgr : public StelModule
50
//! Construct a LabelMgr object.
54
///////////////////////////////////////////////////////////////////////////
55
// Methods defined in the StelModule class
56
//! Initialize the LabelMgr object.
60
virtual void draw(StelCore* core);
62
//! Update time-dependent parts of the module.
63
virtual void update(double deltaTime);
65
//! Defines the order in which the various modules are drawn.
66
virtual double getCallOrder(StelModuleActionName actionName) const;
69
//! Create a label which is attached to a StelObject.
70
//! @param text the text to display
71
//! @param objectName the English name of the object to attach to
72
//! @param visible if true, the label starts displayed, else it starts hidden
73
//! @param fontSize size of the font to use
74
//! @param fontColor HTML-like color spec, e.g. "#ffff00" for yellow
75
//! @param side where the label appears in relation to object:
76
//! - "N" = above object on screen
77
//! - "S" = below object on screen
78
//! - "E" = to the right of the object on screen
79
//! - "W" = to the left of the object on screen
80
//! - "NE", "NW", "SE", "SW" work too.
81
//! @return a unique ID which can be used to refer to the label.
82
//! returns -1 if the label could not be created (e.g. object not found)
83
int labelObject(const QString& text,
84
const QString& objectName,
87
const QString& fontColor="#999999",
88
const QString& side="E",
89
double labelDistance=-1.0,
90
const QString& style="TextOnly");
92
//! Create a label at fixed screen coordinates
93
//! @param text the text to display
94
//! @param x the horizontal position on the screen, in pixels.
95
//! @param y the vertical position on the screen, in pixels.
96
//! @param visible if true, the label starts displayed, else it starts hidden
97
//! @param fontSize size of the font to use
98
//! @param fontColor HTML-like color spec, e.g. "#ffff00" for yellow
99
int labelScreen(const QString& text,
104
const QString& fontColor="#999999");
106
//! find out if a label identified by id is presently shown
107
bool getLabelShow(int id);
108
//! set a label identified by id to be shown or not
109
void setLabelShow(int id, bool show);
110
//! Delete a label by the ID which was returned from addLabel...
111
//! @return true if the id existed and was deleted, else false
112
bool deleteLabel(int id);
113
//! Delete all labels.
114
//! @return the number of labels deleted
115
int deleteAllLabels(void);
118
QVector<class StelLabel*> allLabels;
121
#endif // _SKYLABELMGR_HPP_