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


tuw_multi_robot_rviz
Author(s): Benjamin Binder
autogenerated on Mon Jun 10 2019 15:42:40