MovableText.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef GAZEBO_RENDERING_MOVABLETEXT_HH_
18 #define GAZEBO_RENDERING_MOVABLETEXT_HH_
19 
20 #include <memory>
21 #include <string>
22 
23 #include <ignition/math/Box.hh>
24 #include <ignition/math/Color.hh>
25 
26 // TODO: remove this line
28 
29 #include "gazebo/util/system.hh"
30 
31 namespace gazebo
32 {
33  namespace rendering
34  {
35  class MovableTextPrivate;
36 
39 
42  class GZ_RENDERING_VISIBLE MovableText
43  : public Ogre::MovableObject, public Ogre::Renderable
44  {
47  public: enum HorizAlign {
51  H_CENTER
52  };
53 
56  public: enum VertAlign {
60  V_ABOVE
61  };
62 
64  public: MovableText();
65 
67  public: virtual ~MovableText();
68 
75  public: void Load(const std::string &_name,
76  const std::string &_text,
77  const std::string &_fontName = "Arial",
78  float _charHeight = 1.0,
79  const ignition::math::Color &_color =
80  ignition::math::Color::White);
81 
86  public: void SetFontName(const std::string &_font);
87 
91  public: const std::string &FontName() const;
92 
96  public: void SetText(const std::string &_text);
97 
101  public: const std::string &Text() const;
102 
106  public: void SetColor(const ignition::math::Color &_color);
107 
111  public: const ignition::math::Color &Color() const;
112 
116  public: void SetCharHeight(const float _height);
117 
121  public: float CharHeight() const;
122 
126  public: void SetSpaceWidth(const float _width);
127 
131  public: float SpaceWidth() const;
132 
136  public: void SetTextAlignment(const HorizAlign &_hAlign,
137  const VertAlign &_vAlign);
138 
142  public: void SetBaseline(const float _height);
143 
147  public: float Baseline() const;
148 
153  public: void SetShowOnTop(const bool _show);
154 
158  public: bool ShowOnTop() const;
159 
162  public: ignition::math::Box AABB();
163 
165  public: void Update();
166 
172  public: virtual void visitRenderables(Ogre::Renderable::Visitor *_visitor,
173  bool _debug = false) override;
174 
176  protected: void SetupGeometry();
177 
179  protected: void UpdateColors();
180 
183  protected: void getWorldTransforms(Ogre::Matrix4 *_xform) const override;
184 
187  protected: float getBoundingRadius() const override;
188 
191  protected: float getSquaredViewDepth(const Ogre::Camera *_cam) const
192  override;
193 
196  protected: void getRenderOperation(Ogre::RenderOperation &_op) override;
197 
200  protected: const Ogre::MaterialPtr &getMaterial() const override;
201 
204  protected: const Ogre::LightList &getLights() const override;
205 
207  private: const Ogre::AxisAlignedBox &getBoundingBox() const override;
208 
210  private: const Ogre::String &getMovableType() const override;
211 
213  private: void _notifyCurrentCamera(Ogre::Camera *_cam) override;
214 
216  private: void _updateRenderQueue(Ogre::RenderQueue *_queue) override;
217 
220  private: std::unique_ptr<MovableTextPrivate> dataPtr;
221  };
223  }
224 }
225 #endif
VertAlign
vertical alignment
Definition: MovableText.hh:56
Movable text.
Definition: MovableText.hh:42
Forward declarations for the common classes.
Definition: Animation.hh:26
Left alignment.
Definition: MovableText.hh:49
Align below.
Definition: MovableText.hh:58
HorizAlign
Horizontal alignment.
Definition: MovableText.hh:47