Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include <rve_render_client/scene.h>
00031 #include <rve_render_client/client_context.h>
00032 #include <rve_msgs/make_vector3.h>
00033 #include <rve_interfaces/BillboardText.h>
00034
00035 #include <boost/bind.hpp>
00036
00037 #include "rve_render_client/billboard_text.h"
00038
00039 namespace rve_render_client
00040 {
00041
00042 BillboardTextPtr createBillboardText(const std::string& text)
00043 {
00044 BillboardTextPtr bbtext(new BillboardText(), destroySceneObject);
00045 bbtext->setText(text);
00046 return bbtext;
00047 }
00048
00049 BillboardTextPtr createBillboardText(Scene* scene, const std::string& text)
00050 {
00051 BillboardTextPtr bbtext = createBillboardText( text );
00052 scene->addObject( bbtext.get() );
00053 return bbtext;
00054 }
00055
00056 BillboardText::BillboardText()
00057 {
00058 proxy_index_ = addProxy("billboard_text");
00059
00060 alignment_.horizontal = rve_msgs::TextAlignment::H_LEFT;
00061 alignment_.vertical = rve_msgs::TextAlignment::V_TOP;
00062 }
00063
00064 BillboardText::~BillboardText()
00065 {
00066 }
00067
00068 rve_interfaces::BillboardTextProxy* BillboardText::getProxy(const ContextInfo& context)
00069 {
00070 return SceneObject::getProxy<rve_interfaces::BillboardTextProxy>(context, proxy_index_);
00071 }
00072
00073 void BillboardText::doCreate(ContextInfo& context)
00074 {
00075 rve_interfaces::BillboardTextProxy* proxy = getProxy(context);
00076 proxy->create(getSceneID(context.scene), getID());
00077
00078 rve_common::UUID scene_id = getSceneID(context.scene);
00079 proxy->setTextAsync(scene_id, getID(), text_);
00080 proxy->setPositionAsync(scene_id, getID(), position_);
00081 proxy->setCharacterHeightAsync(scene_id, getID(), character_height_);
00082 proxy->setColorAsync(scene_id, getID(), color_);
00083 proxy->setAlignmentAsync(scene_id, getID(), alignment_);
00084 }
00085
00086 void BillboardText::doDestroy(ContextInfo& context)
00087 {
00088 rve_interfaces::BillboardTextProxy* proxy = getProxy(context);
00089 proxy->destroyAsync(getSceneID(context.scene), getID());
00090 }
00091
00092 void BillboardText::getContextDependencies(V_UUID& deps)
00093 {
00094 }
00095
00096 #define BILLBOARD_TEXT_MULTIPLEX(func, ...) \
00097 multiplex<rve_interfaces::BillboardTextProxy>(boost::bind(&rve_interfaces::BillboardTextProxy::func, _1, _2, getID(), __VA_ARGS__), proxy_index_);
00098
00099 void BillboardText::setPosition(const rve_msgs::Vector3& pos)
00100 {
00101 position_ = pos;
00102 BILLBOARD_TEXT_MULTIPLEX(setPositionAsync, pos);
00103 }
00104
00105 void BillboardText::setText(const std::string& text)
00106 {
00107 text_ = text;
00108 BILLBOARD_TEXT_MULTIPLEX(setTextAsync, text);
00109 }
00110
00113 void BillboardText::setCharacterHeight( float height )
00114 {
00115 character_height_ = height;
00116 BILLBOARD_TEXT_MULTIPLEX(setCharacterHeightAsync, height);
00117 }
00118
00123 void BillboardText::setHorizontalAlignment( uint8_t h )
00124 {
00125 alignment_.horizontal = h;
00126 BILLBOARD_TEXT_MULTIPLEX(setAlignmentAsync, alignment_);
00127 }
00128
00133 void BillboardText::setVerticalAlignment( uint8_t v )
00134 {
00135 alignment_.vertical = v;
00136 BILLBOARD_TEXT_MULTIPLEX(setAlignmentAsync, alignment_);
00137 }
00138
00141 void BillboardText::setColor(const rve_msgs::ColorRGB& color)
00142 {
00143 color_ = color;
00144 BILLBOARD_TEXT_MULTIPLEX(setColorAsync, color);
00145 }
00146
00147 }