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/common/Color.hh"
30 #include "gazebo/util/system.hh"
31 
32 namespace gazebo
33 {
34  namespace rendering
35  {
36  class MovableTextPrivate;
37 
40 
43  class GZ_RENDERING_VISIBLE MovableText
44  : public Ogre::MovableObject, public Ogre::Renderable
45  {
48  public: enum HorizAlign {
52  H_CENTER
53  };
54 
57  public: enum VertAlign {
61  V_ABOVE
62  };
63 
65  public: MovableText();
66 
68  public: virtual ~MovableText();
69 
77  public: void Load(const std::string &_name,
78  const std::string &_text,
79  const std::string &_fontName,
80  float _charHeight,
81  const common::Color &_color)
82  GAZEBO_DEPRECATED(9.0);
83 
90  public: void Load(const std::string &_name,
91  const std::string &_text,
92  const std::string &_fontName = "Arial",
93  float _charHeight = 1.0,
94  const ignition::math::Color &_color =
95  ignition::math::Color::White);
96 
101  public: void SetFontName(const std::string &_font);
102 
106  public: const std::string &GetFont() const GAZEBO_DEPRECATED(9.0);
107 
111  public: const std::string &FontName() const;
112 
116  public: void SetText(const std::string &_text);
117 
121  public: const std::string &GetText() const GAZEBO_DEPRECATED(9.0);
122 
126  public: const std::string &Text() const;
127 
131  public: void SetColor(const common::Color &_color) GAZEBO_DEPRECATED(9.0);
132 
136  public: void SetColor(const ignition::math::Color &_color);
137 
141  public: const common::Color GetColor() const GAZEBO_DEPRECATED(9.0);
142 
146  public: const ignition::math::Color &Color() const;
147 
151  public: void SetCharHeight(const float _height);
152 
156  public: float GetCharHeight() const GAZEBO_DEPRECATED(9.0);
157 
161  public: float CharHeight() const;
162 
166  public: void SetSpaceWidth(const float _width);
167 
171  public: float GetSpaceWidth() const GAZEBO_DEPRECATED(9.0);
172 
176  public: float SpaceWidth() const;
177 
181  public: void SetTextAlignment(const HorizAlign &_hAlign,
182  const VertAlign &_vAlign);
183 
187  public: void SetBaseline(const float _height);
188 
192  public: float GetBaseline() const GAZEBO_DEPRECATED(9.0);
193 
197  public: float Baseline() const;
198 
203  public: void SetShowOnTop(const bool _show);
204 
208  public: bool GetShowOnTop() const GAZEBO_DEPRECATED(9.0);
209 
213  public: bool ShowOnTop() const;
214 
217  public: ignition::math::Box AABB();
218 
220  public: void Update();
221 
227  public: virtual void visitRenderables(Ogre::Renderable::Visitor *_visitor,
228  bool _debug = false) override;
229 
232  protected: void _setupGeometry() GAZEBO_DEPRECATED(9.0);
233 
235  protected: void SetupGeometry();
236 
239  protected: void _updateColors() GAZEBO_DEPRECATED(9.0);
240 
242  protected: void UpdateColors();
243 
246  protected: void getWorldTransforms(Ogre::Matrix4 *_xform) const override;
247 
250  protected: float getBoundingRadius() const override;
251 
254  protected: float getSquaredViewDepth(const Ogre::Camera *_cam) const
255  override;
256 
259  protected: void getRenderOperation(Ogre::RenderOperation &_op) override;
260 
263  protected: const Ogre::MaterialPtr &getMaterial() const override;
264 
268  protected: const Ogre::LightList &getLights() const override;
269 
271  private: const Ogre::AxisAlignedBox &getBoundingBox() const override;
272 
274  private: const Ogre::String &getMovableType() const override;
275 
277  private: void _notifyCurrentCamera(Ogre::Camera *_cam) override;
278 
280  private: void _updateRenderQueue(Ogre::RenderQueue *_queue) override;
281 
284  private: std::unique_ptr<MovableTextPrivate> dataPtr;
285  };
287  }
288 }
289 #endif
Basic camera sensor.
Definition: Camera.hh:81
VertAlign
vertical alignment
Definition: MovableText.hh:57
Movable text.
Definition: MovableText.hh:43
Left alignment.
Definition: MovableText.hh:50
Align below.
Definition: MovableText.hh:59
Defines a color.
Definition: Color.hh:36
#define GAZEBO_DEPRECATED(version)
Definition: system.hh:328
HorizAlign
Horizontal alignment.
Definition: MovableText.hh:48