TextVisual.cpp
Go to the documentation of this file.
1 /*
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2013-2015, Timm Linder, Social Robotics Lab, University of Freiburg
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 *
10 * * Redistributions of source code must retain the above copyright notice, this
11 * list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
15 * * Neither the name of the copyright holder nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 
32 
33 namespace tuw_object_rviz
34 {
35 TextVisual::TextVisual(Ogre::SceneManager* sceneManager, Ogre::SceneNode* parentNode,
36  Ogre::Vector3 position)
37  : m_sceneManager(sceneManager)
38 {
39  m_sceneNode = parentNode->createChildSceneNode();
40 
41  m_text = new rviz::MovableText("text");
43  m_sceneNode->attachObject(m_text);
44 
45  setCharacterHeight(1.0);
46  setPosition(position);
47  setVisible(true);
48 }
49 
51 {
52  m_sceneManager->destroySceneNode(m_sceneNode->getName());
53  delete m_text;
54 };
55 
56 void TextVisual::setCharacterHeight(double characterHeight)
57 {
58  m_text->setCharacterHeight(characterHeight);
59  m_text->setSpaceWidth(0.3 * characterHeight);
60 }
61 
63 {
64  return m_text->getCharacterHeight();
65 }
66 
67 void TextVisual::setCaption(const std::string& caption)
68 {
69  m_text->setCaption(caption);
70 }
71 
72 void TextVisual::setPosition(const Ogre::Vector3& position)
73 {
74  m_sceneNode->setPosition(position);
75 }
76 
77 void TextVisual::setVisible(bool visible)
78 {
79  m_sceneNode->setVisible(visible, true);
80 }
81 
82 void TextVisual::setColor(const Ogre::ColourValue& c)
83 {
84  m_text->setColor(c);
85 }
86 
87 void TextVisual::showOnTop(bool onTop)
88 {
89  m_text->showOnTop(onTop);
90 }
91 
92 }
void showOnTop(bool show=true)
void showOnTop(bool onTop=true)
Definition: TextVisual.cpp:87
void setCharacterHeight(Ogre::Real height)
Ogre::Real getCharacterHeight() const
void setPosition(const Ogre::Vector3 &position)
Definition: TextVisual.cpp:72
void setColor(const Ogre::ColourValue &c)
Definition: TextVisual.cpp:82
void setCaption(const Ogre::String &caption)
void setSpaceWidth(Ogre::Real width)
void setTextAlignment(const HorizontalAlignment &horizontalAlignment, const VerticalAlignment &verticalAlignment)
void setVisible(bool visible)
Definition: TextVisual.cpp:77
void setColor(const Ogre::ColourValue &color)
TextVisual(Ogre::SceneManager *sceneManager, Ogre::SceneNode *parentNode, Ogre::Vector3 position=Ogre::Vector3::ZERO)
Definition: TextVisual.cpp:35
rviz::MovableText * m_text
Definition: TextVisual.h:64
Ogre::SceneNode * m_sceneNode
Definition: TextVisual.h:63
void setCharacterHeight(double characterHeight)
Definition: TextVisual.cpp:56
Ogre::SceneManager * m_sceneManager
Definition: TextVisual.h:62
void setCaption(const std::string &caption)
Definition: TextVisual.cpp:67


tuw_object_rviz
Author(s): Florian Beck
autogenerated on Mon Jun 10 2019 15:40:17