Stellarium 0.12.2
List of all members | Public Member Functions
TextParams Struct Reference

Parameters specifying how to draw text. More...

#include <StelRenderer.hpp>

Public Member Functions

 TextParams (const float x, const float y, const QString &string)
 Construct TextParams with default parameters. More...
 
template<class F >
 TextParams (Vector3< F > &position3D, StelProjectorP projector, const QString &string)
 Construct TextParams to draw text at a 3D position, using specified projector. More...
 
TextParamsangleDegrees (const float angle)
 Angle of text rotation in degrees. More...
 
TextParamsshift (const float x, const float y)
 Shift of the text in rotated direction in pixels. More...
 
TextParamsuseGravity ()
 Draw the text with gravity. More...
 
TextParamsprojector (StelProjectorP projector)
 Projector to project coordinates of the text with. More...
 

Detailed Description

Parameters specifying how to draw text.

These are passed to StelRenderer::drawText().

This is a builder-style struct. Parameters can be specified like this:

// Note that text position and string must be always specified, so they
// are in the constructor.
// Default parameters (no rotation, no shift, no gravity, 2D projection).
TextParams a(16, 16, "Hello World");
// Rotate by 30 degrees.
TextParams b = TextParams(16, 16 "Hello World!").angleDegrees(30.0f);
// Rotate by 30 degrees and shift by (8, 4) in rotated direction.
TextParams c = TextParams(16, 16 "Hello World!").angleDegrees(30.0f).shift(8.0f, 4.0f);

Definition at line 146 of file StelRenderer.hpp.

Constructor & Destructor Documentation

TextParams::TextParams ( const float  x,
const float  y,
const QString &  string 
)
inline

Construct TextParams with default parameters.

Text position and string are required, so they are specified here.

Parameters
x= Horizontal position of lower left corner of the text in pixels.
y= Vertical position of lower left corner of the text in pixels.
string= Text string to draw.

Default values of other parameters are: rotation of 0.0 degrees, shift in rotated direction of (0.0, 0.0), don't draw with gravity, 2D (NULL) projection.

Definition at line 160 of file StelRenderer.hpp.

template<class F >
TextParams::TextParams ( Vector3< F > &  position3D,
StelProjectorP  projector,
const QString &  string 
)
inline

Construct TextParams to draw text at a 3D position, using specified projector.

The renderer will project the position to 2D coordinates before drawing. The required string parameter is also set, as is the projector. Other parameters are at default values.

Parameters
position3D= 3D position of the text.
projector= Projector to project the 3D position to 2D.
string= Text string to draw.

Default values of other parameters are: rotation of 0.0 degrees, shift in rotated direction of (0.0, 0.0), don't draw with gravity.

Definition at line 184 of file StelRenderer.hpp.

Member Function Documentation

TextParams& TextParams::angleDegrees ( const float  angle)
inline

Angle of text rotation in degrees.

Definition at line 197 of file StelRenderer.hpp.

TextParams& TextParams::projector ( StelProjectorP  projector)
inline

Projector to project coordinates of the text with.

Definition at line 219 of file StelRenderer.hpp.

TextParams& TextParams::shift ( const float  x,
const float  y 
)
inline

Shift of the text in rotated direction in pixels.

Definition at line 204 of file StelRenderer.hpp.

TextParams& TextParams::useGravity ( )
inline

Draw the text with gravity.

Definition at line 212 of file StelRenderer.hpp.


The documentation for this struct was generated from the following file: