Stellarium 0.11.0
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure
Public Slots | Public Member Functions

LabelMgr Class Reference

Allows for creation of custom labels on objects or coordinates. More...

#include <LabelMgr.hpp>

List of all members.

Public Slots

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")
int labelScreen (const QString &text, int x, int y, bool visible=true, float fontSize=14, const QString &fontColor="#999999")
bool getLabelShow (int id)
void setLabelShow (int id, bool show)
void setLabelText (int id, const QString &newText)
bool deleteLabel (int id)
int deleteAllLabels (void)

Public Member Functions

 LabelMgr ()
virtual void init ()
virtual void draw (StelCore *core)
virtual void update (double deltaTime)
virtual double getCallOrder (StelModuleActionName actionName) const

Detailed Description

Allows for creation of custom labels on objects or coordinates.

Because this class is intended for use in scripting (although other uses are also fine), all label types and so on are specified by QString descriptions. TODO: when QT4.5 is out, change implementation to use QGraphicsTextItem. (QT4.5 should allow for opacity changes for fades, but it is not currently implemented.


Member Function Documentation

int LabelMgr::deleteAllLabels ( void  ) [slot]

Delete all labels.

Returns:
the number of labels deleted
bool LabelMgr::deleteLabel ( int  id) [slot]

Delete a label by the ID which was returned from addLabel...

Returns:
true if the id existed and was deleted, else false
int LabelMgr::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" 
) [slot]

Create a label which is attached to a StelObject.

Parameters:
textthe text to display
objectNamethe English name of the object to attach to
visibleif true, the label starts displayed, else it starts hidden
fontSizesize of the font to use
fontColorHTML-like color spec, e.g. "#ffff00" for yellow
sidewhere the label appears in relation to object:

  • "N" = above object on screen
  • "S" = below object on screen
  • "E" = to the right of the object on screen
  • "W" = to the left of the object on screen
  • "NE", "NW", "SE", "SW" work too.
Returns:
a unique ID which can be used to refer to the label. returns -1 if the label could not be created (e.g. object not found)
int LabelMgr::labelScreen ( const QString &  text,
int  x,
int  y,
bool  visible = true,
float  fontSize = 14,
const QString &  fontColor = "#999999" 
) [slot]

Create a label at fixed screen coordinates.

Parameters:
textthe text to display
xthe horizontal position on the screen, in pixels, from the left of the screen
ythe vertical position on the screen, in pixels, from the top of the screen
visibleif true, the label starts displayed, else it starts hidden
fontSizesize of the font to use
fontColorHTML-like color spec, e.g. "#ffff00" for yellow