cee::vis::MarkupPartText3d Class Reference

A MarkupModel part for drawing text positioned and oriented in 3D. More...

Public Member Functions

 MarkupPartText3d ()
 Constructs an empty part. More...
 
virtual PartType type () const
 Returns the type of the part. Always MarkupPart::TEXT_3D. More...
 
virtual BoundingBox boundingBox () const
 Returns the current bounding box of the part. More...
 
virtual void setPriority (int priority)
 Sets render priority of the part. More...
 
virtual int priority () const
 Returns the render priority of the part. More...
 
virtual const Mat4dtransformation () const
 Returns the current transformation matrix for the part. More...
 
virtual void setTransformation (const Mat4d &matrix)
 Sets the transformation matrix to use for the part. More...
 
const Fontfont () const
 Returns the font used to draw the labels in the part. More...
 
void setFont (Font *labelFont)
 Sets the font to use for drawing the labels in the part. More...
 
const Color3ftextColor () const
 Returns the current text color. More...
 
void setTextColor (const Color3f &color)
 Sets the text color of the text items in this part. More...
 
float eyeLiftFactor () const
 Returns the eye lift factor of the 3d text. More...
 
void setEyeLiftFactor (float factor)
 Sets the eye lift factor for the 3d text. More...
 
unsigned int maximumNumberOfLabelsToDraw () const
 Returns the maximum number of text items to draw in this part. More...
 
void setMaximumNumberOfLabelsToDraw (unsigned int maximumNumberToDraw)
 Sets the maximum number of text items to draw in the part. More...
 
size_t count () const
 Returns the number of text items in the part. More...
 
MarkupText3dItem textItem (size_t index) const
 Returns the text item at the given index. More...
 
size_t add (const MarkupText3dItem &item)
 Adds the given text item to the part. More...
 
size_t add (const Str &text, const Vec3d &position, const Vec3d &directionVector, const Vec3d &upVector, double textHeight)
 Adds a text item to the part with the given parameters. More...
 
void set (size_t index, const MarkupText3dItem &item)
 Sets the text item at the given index. More...
 
void remove (size_t index)
 Removes the text item at the given index. More...
 
void removeAll ()
 Removes all labels in the part. More...
 
- Public Member Functions inherited from cee::vis::MarkupPart
bool visible () const
 Returns true if the part is visible. More...
 
void setVisible (bool visible)
 Sets if the part should be visible or not. More...
 
- Public Member Functions inherited from cee::RefCountedObject
void addRef () const
 Increments the reference count for this object. More...
 
void release () const
 Decrements the reference count for this object. More...
 
int refCount () const
 Returns the reference count for this object. More...
 
void setRefCountZero () const
 Sets the ref count to zero, but DOES NOT delete the object. More...
 

Static Public Member Functions

static PtrRef< MarkupPartText3dcreate (const Str &text, const Color3f &color, const Vec3d &position, const Vec3d &directionVector, const Vec3d &upVector, double textHeight)
 Returns a newly created part with the given settings. More...
 

Additional Inherited Members

- Public Types inherited from cee::vis::MarkupPart
enum  PartType {
  LABELS, TEXTS_3D, TRIANGLES, INSTANCED_GEOMETRY,
  LINES, POINTS, ARROWS, FIXED_SIZE_ARROW,
  FIXED_SIZE_SPHERE, FIXED_SIZE_IMAGE_GLYPH
}
 Enum specifying the type of MarkupPart. More...
 
Inheritance diagram for cee::vis::MarkupPartText3d:
cee::vis::MarkupPart cee::RefCountedObject

Detailed Description

A MarkupModel part for drawing text positioned and oriented in 3D.

The part can contain any number of text items (MarkupText3dItem). Each text item's position, orientation and size described by:

  • position: World coordinate position of the bottom left corner of the text
  • directionVector: The horizontal direction (local x axis) of the text
  • upVector: The vertical axis (local y axis) of the text
  • textHeight: The height of the text along the upVector axis. This determines the size of the text

The texts support picking through the MarkupModel::rayIntersect() method, but as this only returns the part index, you will have to split your text into parts according to the granularity required for picking.

Example:

m_view->addModel(myModel.get());
std::vector<cee::Vec3d> tris;
tris.push_back(cee::Vec3d(0, 0, 0)); tris.push_back(cee::Vec3d(2, 2, 0)); tris.push_back(cee::Vec3d(2, 2, 1));
tris.push_back(cee::Vec3d(0, 0, 0)); tris.push_back(cee::Vec3d(2, 2, 1)); tris.push_back(cee::Vec3d(0, 0, 1));
myModel->addPart(cee::vis::MarkupPartTriangles::create(tris, cee::Color3f(0.0f, 0.51f, 0.64f), 1.0f).get());
myText->setTextColor(cee::Color3f(0,0,0));
#ifdef WIN32
{
cee::Str trueTypeFontName;
TCHAR windir[MAX_PATH];
GetWindowsDirectory(windir, MAX_PATH);
cee::Str fontFilename = cee::Str(windir) + "\\Fonts\\arial.ttf";
myText->setFont(font.get());
}
#endif
myText->add("Ceetron", cee::Vec3d(0.1, 0.1, 0.6), cee::Vec3d(1,1,0), cee::Vec3d(0,0,1), 0.3);
myText->add("Desktop Components", cee::Vec3d(0.1, 0.1, 0.1), cee::Vec3d(1,1,0), cee::Vec3d(0,0,1), 0.25);
myModel->addPart(myText.get());
See also
MarkupModel

Constructor & Destructor Documentation

cee::vis::MarkupPartText3d::MarkupPartText3d ( )

Constructs an empty part.

Member Function Documentation

size_t cee::vis::MarkupPartText3d::add ( const MarkupText3dItem item)

Adds the given text item to the part.

See also
MarkupText3dItem
size_t cee::vis::MarkupPartText3d::add ( const Str text,
const Vec3d position,
const Vec3d directionVector,
const Vec3d upVector,
double  textHeight 
)

Adds a text item to the part with the given parameters.

Note that directionVector and upVector cannot be zero vectors and they do not need to be normalized

The textHeight is the height of the text (in world coordinates) (in the upVector direction).

BoundingBox cee::vis::MarkupPartText3d::boundingBox ( ) const
virtual

Returns the current bounding box of the part.

Implements cee::vis::MarkupPart.

size_t cee::vis::MarkupPartText3d::count ( ) const

Returns the number of text items in the part.

PtrRef< MarkupPartText3d > cee::vis::MarkupPartText3d::create ( const Str text,
const Color3f color,
const Vec3d position,
const Vec3d directionVector,
const Vec3d upVector,
double  textHeight 
)
static

Returns a newly created part with the given settings.

The returned part will have the specified color and have one text item with the given parameters

float cee::vis::MarkupPartText3d::eyeLiftFactor ( ) const

Returns the eye lift factor of the 3d text.

See also
setEyeLiftFactor
const Font * cee::vis::MarkupPartText3d::font ( ) const

Returns the font used to draw the labels in the part.

unsigned int cee::vis::MarkupPartText3d::maximumNumberOfLabelsToDraw ( ) const

Returns the maximum number of text items to draw in this part.

int cee::vis::MarkupPartText3d::priority ( ) const
virtual

Returns the render priority of the part.

Implements cee::vis::MarkupPart.

void cee::vis::MarkupPartText3d::remove ( size_t  index)

Removes the text item at the given index.

See also
MarkupText3dItem
void cee::vis::MarkupPartText3d::removeAll ( )

Removes all labels in the part.

void cee::vis::MarkupPartText3d::set ( size_t  index,
const MarkupText3dItem item 
)

Sets the text item at the given index.

See also
MarkupText3dItem
void cee::vis::MarkupPartText3d::setEyeLiftFactor ( float  factor)

Sets the eye lift factor for the 3d text.

The eye lift factor specifies if the text should be moved towards the camera (or away from the camera if the factor is negative).

This is useful for controlling the ordering of items that are defined in the same plane.

void cee::vis::MarkupPartText3d::setFont ( Font labelFont)

Sets the font to use for drawing the labels in the part.

Default is the large built-in font (Font::createLargeFont())

void cee::vis::MarkupPartText3d::setMaximumNumberOfLabelsToDraw ( unsigned int  maximumNumberToDraw)

Sets the maximum number of text items to draw in the part.

The text items within the view volume will be sorted and the closest items up to the given number will be drawn.

void cee::vis::MarkupPartText3d::setPriority ( int  priority)
virtual

Sets render priority of the part.

The render priority determines the order in which parts get rendered. Parts with lower priorities get rendered first. The default priority is 100.

Implements cee::vis::MarkupPart.

void cee::vis::MarkupPartText3d::setTextColor ( const Color3f color)

Sets the text color of the text items in this part.

void cee::vis::MarkupPartText3d::setTransformation ( const Mat4d matrix)
virtual

Sets the transformation matrix to use for the part.

Implements cee::vis::MarkupPart.

const Color3f & cee::vis::MarkupPartText3d::textColor ( ) const

Returns the current text color.

cee::vis::MarkupText3dItem cee::vis::MarkupPartText3d::textItem ( size_t  index) const

Returns the text item at the given index.

See also
MarkupText3dItem
const Mat4d & cee::vis::MarkupPartText3d::transformation ( ) const
virtual

Returns the current transformation matrix for the part.

Implements cee::vis::MarkupPart.

MarkupPartText3d::PartType cee::vis::MarkupPartText3d::type ( ) const
virtual

Returns the type of the part. Always MarkupPart::TEXT_3D.

Implements cee::vis::MarkupPart.