Gazebo Rendering

API Reference

3.7.2
gz/rendering/Text.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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 GZ_RENDERING_TEXT_HH_
18 #define GZ_RENDERING_TEXT_HH_
19 
20 #include <string>
21 
22 #include <gz/math/AxisAlignedBox.hh>
23 #include <gz/math/Color.hh>
24 
25 #include "gz/rendering/config.hh"
26 #include "gz/rendering/Geometry.hh"
27 #include "gz/rendering/Object.hh"
28 
29 namespace ignition
30 {
31  namespace rendering
32  {
33  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
34  //
38  {
40  LEFT = 0,
42  CENTER = 1,
44  RIGHT = 2
45  };
46 
49  enum class TextVerticalAlign
50  {
52  BOTTOM = 0,
54  CENTER = 1,
56  TOP = 2
57  };
58 
62  class IGNITION_RENDERING_VISIBLE Text :
63  public virtual Geometry
64  {
66  public: Text() = default;
67 
69  public: virtual ~Text() = default;
70 
74  public: virtual void SetFontName(const std::string &_font) = 0;
75 
79  public: virtual std::string FontName() const = 0;
80 
84  public: virtual void SetTextString(const std::string &_text) = 0;
85 
89  public: virtual std::string TextString() const = 0;
90 
94  public: virtual void SetColor(const gz::math::Color &_color) = 0;
95 
99  public: virtual gz::math::Color Color() const = 0;
100 
104  public: virtual void SetCharHeight(const float _height) = 0;
105 
109  public: virtual float CharHeight() const = 0;
110 
114  public: virtual void SetSpaceWidth(const float _width) = 0;
115 
119  public: virtual float SpaceWidth() const = 0;
120 
124  public: virtual void SetTextAlignment(const TextHorizontalAlign &_hAlign,
125  const TextVerticalAlign &_vAlign) = 0;
126 
129  public: virtual TextHorizontalAlign HorizontalAlignment() const = 0;
130 
133  public: virtual TextVerticalAlign VerticalAlignment() const = 0;
134 
138  public: virtual void SetBaseline(const float _baseline) = 0;
139 
143  public: virtual float Baseline() const = 0;
144 
149  public: virtual void SetShowOnTop(const bool _onTop) = 0;
150 
154  public: virtual bool ShowOnTop() const = 0;
155 
158  public: virtual gz::math::AxisAlignedBox AABB() const = 0;
159  };
160  }
161  }
162 }
163 
164 #endif
Represents a billboard text geometry that is always facing the camera.
Definition: gz/rendering/Text.hh:62
STL class.
virtual void SetFontName(const std::string &_font)=0
Set the font.
virtual std::string FontName() const =0
Get the font name.
virtual gz::math::AxisAlignedBox AABB() const =0
Get the axis aligned bounding box of the text.
virtual bool ShowOnTop() const =0
Get whether the is displayed above other objects.
Text()=default
Constructor.
virtual gz::math::Color Color() const =0
Get the text color.
virtual TextHorizontalAlign HorizontalAlignment() const =0
Get the horizontal alignment of the text.
virtual float SpaceWidth() const =0
Get the width of spaces between words.
virtual void SetBaseline(const float _baseline)=0
Set the baseline height of the text.
TextVerticalAlign
Text vertical alignment.
Definition: gz/rendering/Text.hh:49
virtual void SetCharHeight(const float _height)=0
Set the height of the character in meters.
virtual ~Text()=default
Destructor.
virtual float CharHeight() const =0
Get the height of the characters in meters return Height of the characters.
virtual void SetSpaceWidth(const float _width)=0
Set the width of spaces between words.
virtual std::string TextString() const =0
Get the displayed text.
virtual void SetColor(const gz::math::Color &_color)=0
Set the text color.
virtual void SetShowOnTop(const bool _onTop)=0
True = text always is displayed ontop.
virtual void SetTextAlignment(const TextHorizontalAlign &_hAlign, const TextVerticalAlign &_vAlign)=0
Set the alignment of the text.
virtual float Baseline() const =0
Get the baseline height in meters.
virtual void SetTextString(const std::string &_text)=0
Set the text to display.
TextHorizontalAlign
Text Horizontal alignment.
Definition: gz/rendering/Text.hh:37
virtual TextVerticalAlign VerticalAlignment() const =0
Get the vertical alignment of the text.
Represents a geometric shape to be rendered.
Definition: gz/rendering/Geometry.hh:34