Privacy
An open-source, flexible 3D physical simulation framework
osg_text::Text Class Reference

#include <Text.h>

Public Member Functions

 Text (std::string text="", double fontSize=12, Color textColor=Color(), double posX=0., double posY=0., TextAlign textAlign=ALIGN_LEFT, double paddingL=0., double paddingT=0., double paddingR=0., double paddingB=0., Color backgroundColor=Color(), Color borderColor=Color(), double borderWidth=0.0, std::string fontPath="")
 
 ~Text ()
 
void setText (const std::string &s)
 
void setFontSize (const double fontSize)
 
void setBackgroundColor (const Color &c)
 
void setBorderColor (const Color &c)
 
void setBorderWidth (double w)
 
void setPadding (double left, double top, double right, double bottom)
 
void * getOSGNode ()
 
void setFixedWidth (double w)
 
void setFixedHeight (double h)
 
void setPosition (double x, double y)
 
void setFontResolution (int x, int y)
 
void getRectangle (double *left, double *right, double *top, double *bottom)
 
void getPosition (double *x, double *y)
 
std::string getText ()
 
double getFontsize ()
 
void getPadding (double *pl, double *pt, double *pr, double *pb)
 
TextAlign getAlign ()
 
Color getBackgroundColor ()
 
Color getBorderColor ()
 
double getBorderWidth ()
 
std::string getFont ()
 
- Public Member Functions inherited from osg_text::TextInterface
 TextInterface ()
 
virtual ~TextInterface ()
 

Private Member Functions

void updateSize ()
 
void updateBoundingBox ()
 
void updatePosition ()
 
void createBackground (Color bgColor)
 
void updateBackgroundPos ()
 
void createBorder (Color bColor)
 
void updateBorderPos ()
 

Private Attributes

osg::ref_ptr< osg::PositionAttitudeTransform > transform
 
osg::ref_ptr< osgText::Text > labelText
 
osg::ref_ptr< osg::Geode > labelGeode
 
osg::ref_ptr< osg::Geode > backgroundGeode
 
osg::ref_ptr< osg::Geode > borderGeode
 
osg::ref_ptr< osg::Geometry > backgroundGeom
 
osg::ref_ptr< osg::Geometry > borderGeom
 
osg::ref_ptr< osg::Vec3Array > backgroundVertices
 
osg::ref_ptr< osg::Vec3Array > borderVertices
 
osg::ref_ptr< osg::MatrixTransform > resolutionCorrection
 
double width
 
double height
 
double posX
 
double posXI
 
double posY
 
TextAlign textAlign
 
double pl
 
double pt
 
double pr
 
double pb
 
double fixedWidth
 
double fixedHeight
 
double w
 
double h
 
double posXB
 
double fontSize
 
osg::ref_ptr< osg::Vec4Array > backgroundColor
 
osg::ref_ptr< osg::Vec4Array > borderColor
 
double borderWidth
 
double resolutionCorrectionX
 
double resolutionCorrectionY
 
std::string text_
 
std::string font
 

Detailed Description

Definition at line 45 of file Text.h.

Constructor & Destructor Documentation

◆ Text()

osg_text::Text::Text ( std::string  text = "",
double  fontSize = 12,
Color  textColor = Color(),
double  posX = 0.,
double  posY = 0.,
TextAlign  textAlign = ALIGN_LEFT,
double  paddingL = 0.,
double  paddingT = 0.,
double  paddingR = 0.,
double  paddingB = 0.,
Color  backgroundColor = Color(),
Color  borderColor = Color(),
double  borderWidth = 0.0,
std::string  fontPath = "" 
)

Definition at line 56 of file Text.cpp.

◆ ~Text()

osg_text::Text::~Text ( void  )

Definition at line 118 of file Text.cpp.

Member Function Documentation

◆ createBackground()

void osg_text::Text::createBackground ( Color  bgColor)
private

Definition at line 226 of file Text.cpp.

◆ createBorder()

void osg_text::Text::createBorder ( Color  bColor)
private

Definition at line 274 of file Text.cpp.

◆ getAlign()

TextAlign osg_text::Text::getAlign ( )
virtual

Implements osg_text::TextInterface.

Definition at line 380 of file Text.cpp.

◆ getBackgroundColor()

Color osg_text::Text::getBackgroundColor ( )
virtual

Implements osg_text::TextInterface.

Definition at line 384 of file Text.cpp.

◆ getBorderColor()

Color osg_text::Text::getBorderColor ( )
virtual

Implements osg_text::TextInterface.

Definition at line 393 of file Text.cpp.

◆ getBorderWidth()

double osg_text::Text::getBorderWidth ( )
virtual

Implements osg_text::TextInterface.

Definition at line 402 of file Text.cpp.

◆ getFont()

std::string osg_text::Text::getFont ( )
virtual

Implements osg_text::TextInterface.

Definition at line 406 of file Text.cpp.

◆ getFontsize()

double osg_text::Text::getFontsize ( )
virtual

Implements osg_text::TextInterface.

Definition at line 369 of file Text.cpp.

◆ getOSGNode()

void * osg_text::Text::getOSGNode ( )
virtual

Implements osg_text::TextInterface.

Definition at line 153 of file Text.cpp.

◆ getPadding()

void osg_text::Text::getPadding ( double *  pl,
double *  pt,
double *  pr,
double *  pb 
)
virtual

Implements osg_text::TextInterface.

Definition at line 373 of file Text.cpp.

◆ getPosition()

void osg_text::Text::getPosition ( double *  x,
double *  y 
)
virtual

Implements osg_text::TextInterface.

Definition at line 360 of file Text.cpp.

◆ getRectangle()

void osg_text::Text::getRectangle ( double *  left,
double *  right,
double *  top,
double *  bottom 
)
virtual

Implements osg_text::TextInterface.

Definition at line 352 of file Text.cpp.

◆ getText()

std::string osg_text::Text::getText ( )
virtual

Implements osg_text::TextInterface.

Definition at line 365 of file Text.cpp.

◆ setBackgroundColor()

void osg_text::Text::setBackgroundColor ( const Color c)
virtual

Implements osg_text::TextInterface.

Definition at line 135 of file Text.cpp.

◆ setBorderColor()

void osg_text::Text::setBorderColor ( const Color c)
virtual

Implements osg_text::TextInterface.

Definition at line 140 of file Text.cpp.

◆ setBorderWidth()

void osg_text::Text::setBorderWidth ( double  w)
virtual

Implements osg_text::TextInterface.

Definition at line 310 of file Text.cpp.

◆ setFixedHeight()

void osg_text::Text::setFixedHeight ( double  h)
virtual

Implements osg_text::TextInterface.

Definition at line 162 of file Text.cpp.

◆ setFixedWidth()

void osg_text::Text::setFixedWidth ( double  w)
virtual

Implements osg_text::TextInterface.

Definition at line 157 of file Text.cpp.

◆ setFontResolution()

void osg_text::Text::setFontResolution ( int  x,
int  y 
)
virtual

Implements osg_text::TextInterface.

Definition at line 338 of file Text.cpp.

◆ setFontSize()

void osg_text::Text::setFontSize ( const double  fontSize)

Definition at line 129 of file Text.cpp.

◆ setPadding()

void osg_text::Text::setPadding ( double  left,
double  top,
double  right,
double  bottom 
)
virtual

Implements osg_text::TextInterface.

Definition at line 145 of file Text.cpp.

◆ setPosition()

void osg_text::Text::setPosition ( double  x,
double  y 
)
virtual

Implements osg_text::TextInterface.

Definition at line 167 of file Text.cpp.

◆ setText()

void osg_text::Text::setText ( const std::string &  s)
virtual

Implements osg_text::TextInterface.

Definition at line 121 of file Text.cpp.

◆ updateBackgroundPos()

void osg_text::Text::updateBackgroundPos ( )
private

Definition at line 262 of file Text.cpp.

◆ updateBorderPos()

void osg_text::Text::updateBorderPos ( )
private

Definition at line 323 of file Text.cpp.

◆ updateBoundingBox()

void osg_text::Text::updateBoundingBox ( )
private

Definition at line 184 of file Text.cpp.

◆ updatePosition()

void osg_text::Text::updatePosition ( )
private

Definition at line 195 of file Text.cpp.

◆ updateSize()

void osg_text::Text::updateSize ( )
private

Definition at line 177 of file Text.cpp.

Member Data Documentation

◆ backgroundColor

osg::ref_ptr<osg::Vec4Array> osg_text::Text::backgroundColor
private

Definition at line 98 of file Text.h.

◆ backgroundGeode

osg::ref_ptr<osg::Geode> osg_text::Text::backgroundGeode
private

Definition at line 84 of file Text.h.

◆ backgroundGeom

osg::ref_ptr<osg::Geometry> osg_text::Text::backgroundGeom
private

Definition at line 86 of file Text.h.

◆ backgroundVertices

osg::ref_ptr<osg::Vec3Array> osg_text::Text::backgroundVertices
private

Definition at line 88 of file Text.h.

◆ borderColor

osg::ref_ptr<osg::Vec4Array> osg_text::Text::borderColor
private

Definition at line 98 of file Text.h.

◆ borderGeode

osg::ref_ptr<osg::Geode> osg_text::Text::borderGeode
private

Definition at line 85 of file Text.h.

◆ borderGeom

osg::ref_ptr<osg::Geometry> osg_text::Text::borderGeom
private

Definition at line 87 of file Text.h.

◆ borderVertices

osg::ref_ptr<osg::Vec3Array> osg_text::Text::borderVertices
private

Definition at line 89 of file Text.h.

◆ borderWidth

double osg_text::Text::borderWidth
private

Definition at line 99 of file Text.h.

◆ fixedHeight

double osg_text::Text::fixedHeight
private

Definition at line 96 of file Text.h.

◆ fixedWidth

double osg_text::Text::fixedWidth
private

Definition at line 96 of file Text.h.

◆ font

std::string osg_text::Text::font
private

Definition at line 102 of file Text.h.

◆ fontSize

double osg_text::Text::fontSize
private

Definition at line 97 of file Text.h.

◆ h

double osg_text::Text::h
private

Definition at line 96 of file Text.h.

◆ height

double osg_text::Text::height
private

Definition at line 92 of file Text.h.

◆ labelGeode

osg::ref_ptr<osg::Geode> osg_text::Text::labelGeode
private

Definition at line 83 of file Text.h.

◆ labelText

osg::ref_ptr<osgText::Text> osg_text::Text::labelText
private

Definition at line 82 of file Text.h.

◆ pb

double osg_text::Text::pb
private

Definition at line 95 of file Text.h.

◆ pl

double osg_text::Text::pl
private

Definition at line 95 of file Text.h.

◆ posX

double osg_text::Text::posX
private

Definition at line 93 of file Text.h.

◆ posXB

double osg_text::Text::posXB
private

Definition at line 96 of file Text.h.

◆ posXI

double osg_text::Text::posXI
private

Definition at line 93 of file Text.h.

◆ posY

double osg_text::Text::posY
private

Definition at line 93 of file Text.h.

◆ pr

double osg_text::Text::pr
private

Definition at line 95 of file Text.h.

◆ pt

double osg_text::Text::pt
private

Definition at line 95 of file Text.h.

◆ resolutionCorrection

osg::ref_ptr<osg::MatrixTransform> osg_text::Text::resolutionCorrection
private

Definition at line 90 of file Text.h.

◆ resolutionCorrectionX

double osg_text::Text::resolutionCorrectionX
private

Definition at line 100 of file Text.h.

◆ resolutionCorrectionY

double osg_text::Text::resolutionCorrectionY
private

Definition at line 100 of file Text.h.

◆ text_

std::string osg_text::Text::text_
private

Definition at line 101 of file Text.h.

◆ textAlign

TextAlign osg_text::Text::textAlign
private

Definition at line 94 of file Text.h.

◆ transform

osg::ref_ptr<osg::PositionAttitudeTransform> osg_text::Text::transform
private

Definition at line 81 of file Text.h.

◆ w

double osg_text::Text::w
private

Definition at line 96 of file Text.h.

◆ width

double osg_text::Text::width
private

Definition at line 92 of file Text.h.


The documentation for this class was generated from the following files: