Tulip  5.2.0
Large graphs analysis and drawing
tlp::GlLabel Class Referencefinal

#include <GlLabel.h>

+ Inheritance diagram for tlp::GlLabel:
+ Collaboration diagram for tlp::GlLabel:

Public Member Functions

 GlLabel ()
 
 GlLabel (Coord centerPosition, Size size, Color fontColor, bool leftAlign=false)
 
 ~GlLabel () override
 
void draw (float, Camera *camera=nullptr) override
 
void drawWithStencil (float lod, Camera *camera=nullptr)
 
void enableDepthTest (bool state)
 
BoundingBox getBoundingBox () override
 
const Color & getColor () const
 
int getFontSize () const
 
float getHeightAfterScale ()
 
int getLabelDensity () const
 
int getMaxSize () const
 
int getMinSize () const
 
const Color & getOutlineColor () const
 
float getOutlineSize () const
 
const Coord & getPosition () const
 
const Size & getSize () const
 
const Size & getSizeForOutAlign () const
 
const std::string & getText () const
 
const BoundingBoxgetTextBoundingBox ()
 
const std::string & getTextureName () const
 
bool getUseLODOptimisation () const
 
void getXML (std::string &outString) override
 
bool isBillboarded () const
 
bool isUsingMinMaxSize () const
 
void rotate (float xRot, float yRot, float zRot)
 
void setAlignment (int alignment)
 
void setBillboarded (bool billboarded)
 
void setBoldFont ()
 
void setColor (const Color &color)
 
void setFontName (const std::string &name)
 
void setFontNameSizeAndColor (const std::string &name, const int &size, const Color &color)
 
void setFontSize (int size)
 
void setLabelsDensity (int density)
 
void setMaxSize (int size)
 
void setMinSize (int size)
 
void setOcclusionTester (OcclusionTest *tester)
 
void setOutlineColor (const Color &color)
 
void setOutlineSize (float size)
 
void setPlainFont ()
 
void setPosition (const Coord &position)
 
void setPosition (float x, float y, float z)
 
void setScaleToSize (bool state)
 
void setSize (const Size &size)
 
void setSizeForOutAlign (const Size &size)
 
void setText (const std::string &text)
 
void setTextureName (const std::string &name)
 
void setUseLODOptimisation (bool state, const BoundingBox &bb=BoundingBox())
 
void setUseMinMaxSize (bool state)
 
void setWithXML (const std::string &inString, unsigned int &currentPosition) override
 
void translate (const Coord &mouvement) override
 
- Public Member Functions inherited from tlp::GlSimpleEntity
 GlSimpleEntity ()
 
 ~GlSimpleEntity () override
 
int getStencil ()
 
bool isVisible () const
 
virtual void setStencil (int stencil)
 
virtual void setVisible (bool visible)
 

Additional Inherited Members

- Protected Attributes inherited from tlp::GlSimpleEntity
BoundingBox boundingBox
 
std::vector< GlComposite * > parents
 
int stencil
 
bool visible
 

Detailed Description

Create a label into Tulip 3D engine.

The shortes way to create a label is :

GlLabel *label=new GlLabel(Coord(0,0,0), Size (1,1,1), Color(1,1,1));
label->setText("example");

Definition at line 46 of file GlLabel.h.

Constructor & Destructor Documentation

tlp::GlLabel::GlLabel ( )

Constructor.

Warning
Don't use this constructor : see other constructor
tlp::GlLabel::GlLabel ( Coord  centerPosition,
Size  size,
Color  fontColor,
bool  leftAlign = false 
)

Contructor.

Parameters
centerPositionposition of the label
sizesize of the label
fontColorcolor of the label
leftAligntrue if you want a left align label
tlp::GlLabel::~GlLabel ( )
override

Destructor.

Member Function Documentation

void tlp::GlLabel::draw ( float  ,
Camera camera = nullptr 
)
overridevirtual

Draw the Label.

Implements tlp::GlSimpleEntity.

void tlp::GlLabel::drawWithStencil ( float  lod,
Camera camera = nullptr 
)

Set the stencil and draw the Label, this function is usefull when we directly call draw without tulip engine.

void tlp::GlLabel::enableDepthTest ( bool  state)
inline

Enable/disable the OpenGL depth test for the label (default depth test is enable)

Definition at line 201 of file GlLabel.h.

BoundingBox tlp::GlLabel::getBoundingBox ( )
overridevirtual

Return the bounding box of the label.

Reimplemented from tlp::GlSimpleEntity.

const Color& tlp::GlLabel::getColor ( ) const
inline

Get color use to render the label.

Definition at line 194 of file GlLabel.h.

int tlp::GlLabel::getFontSize ( ) const
inline

Return the font size.

Definition at line 374 of file GlLabel.h.

float tlp::GlLabel::getHeightAfterScale ( )

Return the height of the label after scaling in size box.

int tlp::GlLabel::getLabelDensity ( ) const
inline

Return label density of occlusion test This density will be in interval -100 100.

Definition at line 321 of file GlLabel.h.

int tlp::GlLabel::getMaxSize ( ) const
inline

Get max screen size (in pixel) of the label : this size is used in not scaled mode.

See also
setUseMinMaxSize

Definition at line 353 of file GlLabel.h.

int tlp::GlLabel::getMinSize ( ) const
inline

Get min screen size (in pixel) of the label : this size is used in not scaled mode.

See also
setUseMinMaxSize

Definition at line 337 of file GlLabel.h.

const Color& tlp::GlLabel::getOutlineColor ( ) const
inline

Return the outline color.

Definition at line 388 of file GlLabel.h.

float tlp::GlLabel::getOutlineSize ( ) const
inline

Return the outline size.

Definition at line 402 of file GlLabel.h.

const Coord& tlp::GlLabel::getPosition ( ) const
inline

Return the position of the label.

Definition at line 104 of file GlLabel.h.

const Size& tlp::GlLabel::getSize ( ) const
inline

return the size of the text

Definition at line 160 of file GlLabel.h.

const Size& tlp::GlLabel::getSizeForOutAlign ( ) const
inline

return the size for alignment outside (left/right/top/bottom)

See also
setAlignment

Definition at line 180 of file GlLabel.h.

const std::string& tlp::GlLabel::getText ( ) const
inline

getText gets the text of this label.

Returns
The text of this label.

Definition at line 83 of file GlLabel.h.

const BoundingBox& tlp::GlLabel::getTextBoundingBox ( )
inline

Return the bounding box of the text of the label after transformations.

Definition at line 146 of file GlLabel.h.

const std::string& tlp::GlLabel::getTextureName ( ) const
inline

Return the texture name used to render the label.

Definition at line 416 of file GlLabel.h.

bool tlp::GlLabel::getUseLODOptimisation ( ) const
inline

Return if the label is otimized with the lod.

Definition at line 296 of file GlLabel.h.

void tlp::GlLabel::getXML ( std::string &  outString)
overridevirtual

Function to export data in outString (in XML format)

Implements tlp::GlSimpleEntity.

bool tlp::GlLabel::isBillboarded ( ) const
inline

Return if the label is billboarded.

Definition at line 430 of file GlLabel.h.

bool tlp::GlLabel::isUsingMinMaxSize ( ) const
inline

Return if the label using min/max screen size in not scaled mode.

Definition at line 367 of file GlLabel.h.

void tlp::GlLabel::rotate ( float  xRot,
float  yRot,
float  zRot 
)

Rotate Label.

void tlp::GlLabel::setAlignment ( int  alignment)
inline

Set the alignment of the label : LabelPosition::Center, LabelPosition::Top, LabelPosition::Bottom, LabelPosition::Left, LabelPosition::Right This function is usefull when you have an entity : you spesify the size of the position of this entity and you tell that you want a label outside this entity.

See also
LabelPosition
setSizeOfOutAlign

Definition at line 134 of file GlLabel.h.

void tlp::GlLabel::setBillboarded ( bool  billboarded)
inline

Set if the label is billboarded.

Definition at line 437 of file GlLabel.h.

void tlp::GlLabel::setBoldFont ( )

Switch to bold font.

void tlp::GlLabel::setColor ( const Color &  color)
inline

Set color of label.

Definition at line 187 of file GlLabel.h.

void tlp::GlLabel::setFontName ( const std::string &  name)

Change font name.

void tlp::GlLabel::setFontNameSizeAndColor ( const std::string &  name,
const int &  size,
const Color &  color 
)

Change font name, size and color of the text.

void tlp::GlLabel::setFontSize ( int  size)
inline

Sets the font size used when rendering the label.

Definition at line 381 of file GlLabel.h.

void tlp::GlLabel::setLabelsDensity ( int  density)
inline

Set labels density of occlusion test This density must be in interval -100 100.

  • If density is equal to -100 : we don't have occlusion test
  • If density is equal to 0 : GlLabels don't overlap
  • If density > 0 : GlLabels don't overlap and have space wetween us

Definition at line 308 of file GlLabel.h.

void tlp::GlLabel::setMaxSize ( int  size)
inline

Set max screen size (in pixel) of the label : this size is used in not scaled mode.

See also
setUseMinMaxSize

Definition at line 345 of file GlLabel.h.

void tlp::GlLabel::setMinSize ( int  size)
inline

Set min screen size (in pixel) of the label : this size is used in not scaled mode.

See also
setUseMinMaxSize

Definition at line 329 of file GlLabel.h.

void tlp::GlLabel::setOcclusionTester ( OcclusionTest *  tester)
inline

Set the occlusion tester If occlusionTester is nullptr : deactivate occlusion test.

Definition at line 281 of file GlLabel.h.

void tlp::GlLabel::setOutlineColor ( const Color &  color)
inline

Sets the outline color used when rendering the label.

Definition at line 395 of file GlLabel.h.

void tlp::GlLabel::setOutlineSize ( float  size)
inline

Sets the outline size used when rendering the label.

Definition at line 409 of file GlLabel.h.

void tlp::GlLabel::setPlainFont ( )

Switch to plain font.

void tlp::GlLabel::setPosition ( const Coord &  position)
inline

Set the position used to render the label.

Definition at line 90 of file GlLabel.h.

void tlp::GlLabel::setPosition ( float  x,
float  y,
float  z 
)
inline

Set the position used to render the label.

Definition at line 97 of file GlLabel.h.

void tlp::GlLabel::setScaleToSize ( bool  state)
inline

Enable/disable if label is scaled to size.

Definition at line 208 of file GlLabel.h.

void tlp::GlLabel::setSize ( const Size &  size)
inline

Set the size of the label.

Definition at line 153 of file GlLabel.h.

void tlp::GlLabel::setSizeForOutAlign ( const Size &  size)
inline

Set the size for alignment outside (left/right/top/bottom)

You can have a specific size when you want a label outside

See also
setAlignment

: this size is reinit when you call setSize

Definition at line 172 of file GlLabel.h.

void tlp::GlLabel::setText ( const std::string &  text)

Set the text of the label.

void tlp::GlLabel::setTextureName ( const std::string &  name)
inline

Sets the texture name used when rendering the label.

Definition at line 423 of file GlLabel.h.

void tlp::GlLabel::setUseLODOptimisation ( bool  state,
const BoundingBox bb = BoundingBox() 
)
inline

Set if the label is optimized with the lod.

Definition at line 288 of file GlLabel.h.

void tlp::GlLabel::setUseMinMaxSize ( bool  state)
inline

Set if the label use min/max screen size in not scaled mode.

Definition at line 360 of file GlLabel.h.

void tlp::GlLabel::setWithXML ( const std::string &  inString,
unsigned int &  currentPosition 
)
overridevirtual

Function to set data with inString (in XML format)

Implements tlp::GlSimpleEntity.

void tlp::GlLabel::translate ( const Coord &  mouvement)
override

Translate entity.