Gazebo Rendering

API Reference

7.4.2
gz/rendering/base/BaseMarker.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 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_BASEMARKER_HH_
18 #define GZ_RENDERING_BASEMARKER_HH_
19 
20 #include <gz/utils/SuppressWarning.hh>
21 
22 #include "gz/rendering/Marker.hh"
25 
26 namespace gz
27 {
28  namespace rendering
29  {
30  inline namespace GZ_RENDERING_VERSION_NAMESPACE {
32  template <class T>
33  class BaseMarker :
34  public virtual Marker,
35  public virtual T
36  {
38  protected: BaseMarker();
39 
41  public: virtual ~BaseMarker();
42 
44  public: virtual void PreRender() override;
45 
47  public: virtual void Destroy() override;
48 
49  // Documentation inherited
50  public: virtual void SetLifetime(const
51  std::chrono::steady_clock::duration &_lifetime) override;
52 
53  // Documentation inherited
54  public: virtual std::chrono::steady_clock::duration Lifetime()
55  const override;
56 
57  // Documentation inherited
58  public: virtual void SetType(const MarkerType _markerType) override;
59 
60  // Documentation inherited
61  public: virtual MarkerType Type() const override;
62 
63  // Documentation inherited
64  public: virtual void SetSize(double _size) override;
65 
66  // Documentation inherited
67  public: virtual double Size() const override;
68 
69  // Documentation inherited
70  public: virtual void SetLayer(int32_t _layer) override;
71 
72  // Documentation inherited
73  public: virtual int32_t Layer() const override;
74 
75  // Documentation inherited
76  public: virtual void ClearPoints() override;
77 
78  // Documentation inherited
79  public: virtual void AddPoint(double _x,
80  double _y, double _z,
81  const gz::math::Color &_color) override;
82 
83  // Documentation inherited
84  public: virtual void AddPoint(const gz::math::Vector3d &_pt,
85  const gz::math::Color &_color) override;
86 
87  // Documentation inherited
88  public: virtual void SetPoint(unsigned int _index,
89  const gz::math::Vector3d &_value) override;
90 
92  GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
93  protected: std::chrono::steady_clock::duration lifetime =
94  std::chrono::steady_clock::duration::zero();
95  GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
96 
98  protected: int32_t layer = 0;
99 
101  protected: bool markerDirty = false;
102 
104  protected: MarkerType markerType =
106 
108  protected: double size = 1.0;
109  };
110 
112  // BaseMarker
114  template <class T>
116  {
117  }
118 
120  template <class T>
122  {
123  }
124 
126  template <class T>
128  const std::chrono::steady_clock::duration &_lifetime)
129  {
130  this->lifetime = _lifetime;
131  this->markerDirty = true;
132  }
133 
135  template <class T>
136  std::chrono::steady_clock::duration BaseMarker<T>::Lifetime() const
137  {
138  return this->lifetime;
139  }
140 
142  template <class T>
143  void BaseMarker<T>::SetLayer(int32_t _layer)
144  {
145  this->layer = _layer;
146  this->markerDirty = true;
147  }
148 
150  template <class T>
151  int32_t BaseMarker<T>::Layer() const
152  {
153  return this->layer;
154  }
155 
157  template <class T>
158  void BaseMarker<T>::SetType(const MarkerType _markerType)
159  {
160  this->markerType = _markerType;
161  this->markerDirty = true;
162  }
163 
165  template <class T>
167  {
168  return this->markerType;
169  }
170 
172  template <class T>
173  void BaseMarker<T>::SetSize(double _size)
174  {
175  this->size = _size;
176  this->markerDirty = true;
177  }
178 
180  template <class T>
181  double BaseMarker<T>::Size() const
182  {
183  return this->size;
184  }
185 
187  template <class T>
189  {
190  T::PreRender();
191  }
192 
194  template <class T>
196  {
197  T::Destroy();
198  }
199 
201  template <class T>
203  {
204  // no op
205  }
206 
208  template <class T>
210  const gz::math::Color &)
211  {
212  // no op
213  }
214 
216  template <class T>
217  void BaseMarker<T>::AddPoint(double _x, double _y, double _z,
218  const gz::math::Color &_color)
219  {
220  this->AddPoint(gz::math::Vector3d(_x, _y, _z), _color);
221  }
222 
224  template <class T>
225  void BaseMarker<T>::SetPoint(unsigned int,
226  const gz::math::Vector3d &)
227  {
228  // no op
229  }
230  }
231  }
232 }
233 #endif