Go to the documentation of this file.
16 #ifndef SURGSIM_GRAPHICS_OSGTEXTREPRESENTATION_H
17 #define SURGSIM_GRAPHICS_OSGTEXTREPRESENTATION_H
26 #include <boost/thread/mutex.hpp>
30 #pragma warning(disable:4250)
53 SURGSIM_STATIC_REGISTRATION(OsgTextRepresentation);
71 void getLocation(
double* x,
double* y)
const override;
80 void setFont(std::shared_ptr<SurgSim::Framework::Asset> font)
override;
81 std::shared_ptr<Font>
getFont()
const override;
137 #if defined(_MSC_VER)
void doUpdate(double dt) override
Definition: OsgTextRepresentation.cpp:106
void setBackgroundMargin(double margin) override
Set the margin between background and text.
Definition: OsgTextRepresentation.cpp:216
osg::ref_ptr< osgText::Text > m_textNode
node for text display
Definition: OsgTextRepresentation.h:119
void setBackgroundColor(Math::Vector4d color) override
Set the color of the background (if drawn)
Definition: OsgTextRepresentation.cpp:205
double getFontSize() const override
Definition: OsgTextRepresentation.cpp:277
void setMaximumWidth(double width) override
Sets a maximum width to the text display, the text should be broken up into multiple lines if the it ...
Definition: OsgTextRepresentation.cpp:251
SurgSim::DataStructures::OptionalValue< double > getOptionalMaximumWidth() override
Get the current status of the width.
Definition: OsgTextRepresentation.cpp:184
boost::mutex m_parameterMutex
protect changes of parameters
Definition: OsgTextRepresentation.h:127
void setOptionalMaximumWidth(SurgSim::DataStructures::OptionalValue< double > maximum) override
Optionally sets a maximum width to the text display, the text should be broken up into multiple lines...
Definition: OsgTextRepresentation.cpp:177
std::shared_ptr< Font > getFont() const override
Definition: OsgTextRepresentation.cpp:172
bool m_needUpdate
indicate whether parameters need to be updated
Definition: OsgTextRepresentation.h:128
std::string getText() const override
Definition: OsgTextRepresentation.cpp:101
SURGSIM_CLASSNAME(SurgSim::Graphics::OsgTextRepresentation)
Osg implementation of the TextRepresentation, to be used with OsgFont assets.
Definition: OsgTextRepresentation.h:57
Definition: OculusView.h:26
void setDrawBackground(bool value) override
Draw a filled background behind the text.
Definition: OsgTextRepresentation.cpp:189
SurgSim::Math::Vector3d m_offset
Definition: OsgTextRepresentation.h:131
friend class OsgTextRepresentationTests_MaximumWidth_Test
Definition: OsgTextRepresentation.h:66
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
SurgSim::DataStructures::OptionalValue< double > m_optionalWidth
information about the maximum width
Definition: OsgTextRepresentation.h:123
Definition: CompoundShapeToGraphics.cpp:30
int m_anchor
Definition: OsgTextRepresentation.h:129
void setAnchor(int anchor)
void setUseScreenSpace(bool value) override
If set to true all the coordinate values are in screen-space coordinates (i.e.
Definition: OsgTextRepresentation.cpp:226
OsgTextRepresentation(const std::string &name)
Constructor.
Definition: OsgTextRepresentation.cpp:43
Eigen::Matrix< double, 4, 1 > Vector4d
A 4D vector of doubles.
Definition: Vector.h:61
bool isDrawingBackground() const override
Definition: OsgTextRepresentation.cpp:200
double getBackgroundMargin() const override
Definition: OsgTextRepresentation.cpp:221
void loadFont(const std::string &fileName) override
Load the font with the given file name, this will overwrite the current font.
Definition: OsgTextRepresentation.cpp:149
~OsgTextRepresentation()
Destructor.
Definition: OsgTextRepresentation.cpp:76
Math::Vector4d getBackgroundColor() override
Definition: OsgTextRepresentation.cpp:210
A text to be displayed on the screen in screen space coordinates, use setPose() to set the position b...
Definition: TextRepresentation.h:40
void getLocation(double *x, double *y) const override
Gets the location in screen space.
Definition: OsgTextRepresentation.cpp:85
double getMaximumWidth() override
Definition: OsgTextRepresentation.cpp:265
osg::ref_ptr< osg::Geode > m_geode
node used to render text
Definition: OsgTextRepresentation.h:118
void setFontSize(double size) override
Set the vertical size of the font.
Definition: OsgTextRepresentation.cpp:270
bool isUsingScreenSpace() const override
Definition: OsgTextRepresentation.cpp:244
double m_characterSize
the font height
Definition: OsgTextRepresentation.h:125
std::shared_ptr< OsgFont > m_font
font used for rendering
Definition: OsgTextRepresentation.h:122
void setColor(SurgSim::Math::Vector4d color) override
Set the color for the text.
Definition: OsgTextRepresentation.cpp:282
@ ANCHOR_TOP_LEFT
Definition: OsgTextRepresentation.h:94
SurgSim::Math::Vector4d getColor() const override
Definition: OsgTextRepresentation.cpp:287
void setLocation(double x, double y) override
Sets the location in screen space.
Definition: OsgTextRepresentation.cpp:80
std::string m_text
Text set by the user.
Definition: OsgTextRepresentation.h:121
@ ANCHOR_CENTER
Definition: OsgTextRepresentation.h:95
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
bool doInitialize() override
Interface to be implemented by derived classes.
Definition: OsgTextRepresentation.cpp:128
void setFont(std::shared_ptr< SurgSim::Framework::Asset > font) override
Replace the current font with the one passed.
Definition: OsgTextRepresentation.cpp:156
Anchor
Definition: OsgTextRepresentation.h:93
Base OSG implementation of a graphics representation.
Definition: OsgRepresentation.h:56
void setText(const std::string &text) override
Sets the text to be shown on the screen.
Definition: OsgTextRepresentation.cpp:94