Tulip  5.3.1
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 shortest 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

◆ GlLabel() [1/2]

tlp::GlLabel::GlLabel ( )

Constructor.

Warning
Don't use this constructor : see other constructor

◆ GlLabel() [2/2]

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

◆ ~GlLabel()

tlp::GlLabel::~GlLabel ( )
override

Destructor.

Member Function Documentation

◆ draw()

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

Draw the Label.

Implements tlp::GlSimpleEntity.

◆ drawWithStencil()

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

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

◆ enableDepthTest()

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.

◆ getBoundingBox()

BoundingBox tlp::GlLabel::getBoundingBox ( )
overridevirtual

Return the bounding box of the label.

Reimplemented from tlp::GlSimpleEntity.

◆ getColor()

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

Get color use to render the label.

Definition at line 194 of file GlLabel.h.

◆ getFontSize()

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

Return the font size.

Definition at line 374 of file GlLabel.h.

◆ getHeightAfterScale()

float tlp::GlLabel::getHeightAfterScale ( )

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

◆ getLabelDensity()

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.

◆ getMaxSize()

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.

◆ getMinSize()

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.

◆ getOutlineColor()

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

Return the outline color.

Definition at line 388 of file GlLabel.h.

◆ getOutlineSize()

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

Return the outline size.

Definition at line 402 of file GlLabel.h.

◆ getPosition()

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

Return the position of the label.

Definition at line 104 of file GlLabel.h.

◆ getSize()

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

return the size of the text

Definition at line 160 of file GlLabel.h.

◆ getSizeForOutAlign()

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.

◆ getText()

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.

◆ getTextBoundingBox()

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.

◆ getTextureName()

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.

◆ getUseLODOptimisation()

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

Return if the label is otimized with the lod.

Definition at line 296 of file GlLabel.h.

◆ getXML()

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

Function to export data in outString (in XML format)

Implements tlp::GlSimpleEntity.

◆ isBillboarded()

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

Return if the label is billboarded.

Definition at line 430 of file GlLabel.h.

◆ isUsingMinMaxSize()

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.

◆ rotate()

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

Rotate Label.

◆ setAlignment()

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.

◆ setBillboarded()

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

Set if the label is billboarded.

Definition at line 437 of file GlLabel.h.

◆ setBoldFont()

void tlp::GlLabel::setBoldFont ( )

Switch to bold font.

◆ setColor()

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

Set color of label.

Definition at line 187 of file GlLabel.h.

◆ setFontName()

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

Change font name.

◆ setFontNameSizeAndColor()

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

Change font name, size and color of the text.

◆ setFontSize()

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

Sets the font size used when rendering the label.

Definition at line 381 of file GlLabel.h.

◆ setLabelsDensity()

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.

◆ setMaxSize()

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.

◆ setMinSize()

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.

◆ setOcclusionTester()

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.

◆ setOutlineColor()

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.

◆ setOutlineSize()

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

Sets the outline size used when rendering the label.

Definition at line 409 of file GlLabel.h.

◆ setPlainFont()

void tlp::GlLabel::setPlainFont ( )

Switch to plain font.

◆ setPosition() [1/2]

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

Set the position used to render the label.

Definition at line 90 of file GlLabel.h.

◆ setPosition() [2/2]

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.

◆ setScaleToSize()

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

Enable/disable if label is scaled to size.

Definition at line 208 of file GlLabel.h.

◆ setSize()

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

Set the size of the label.

Definition at line 153 of file GlLabel.h.

◆ setSizeForOutAlign()

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.

◆ setText()

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

Set the text of the label.

◆ setTextureName()

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.

◆ setUseLODOptimisation()

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.

◆ setUseMinMaxSize()

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.

◆ setWithXML()

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

Function to set data with inString (in XML format)

Implements tlp::GlSimpleEntity.

◆ translate()

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

Translate entity.