Ignition Rendering

API Reference

4.1.0
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 IGNITION_RENDERING_BASEMARKER_HH_
18 #define IGNITION_RENDERING_BASEMARKER_HH_
19 
23 
24 namespace ignition
25 {
26  namespace rendering
27  {
28  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
30  template <class T>
31  class BaseMarker :
32  public virtual Marker,
33  public virtual T
34  {
36  protected: BaseMarker();
37 
39  public: virtual ~BaseMarker();
40 
42  public: virtual void PreRender() override;
43 
45  public: virtual void Destroy() override;
46 
47  // Documentation inherited
48  public: virtual void SetLifetime(const
49  std::chrono::steady_clock::duration &_lifetime) override;
50 
51  // Documentation inherited
52  public: virtual std::chrono::steady_clock::duration Lifetime()
53  const override;
54 
55  // Documentation inherited
56  public: virtual void SetType(const MarkerType _markerType) override;
57 
58  // Documentation inherited
59  public: virtual MarkerType Type() const override;
60 
61  // Documentation inherited
62  public: virtual void SetLayer(int32_t _layer) override;
63 
64  // Documentation inherited
65  public: virtual int32_t Layer() const override;
66 
67  // Documentation inherited
68  public: virtual void ClearPoints() override;
69 
70  // Documentation inherited
71  public: virtual void AddPoint(double _x,
72  double _y, double _z,
73  const ignition::math::Color &_color) override;
74 
75  // Documentation inherited
76  public: virtual void AddPoint(const ignition::math::Vector3d &_pt,
77  const ignition::math::Color &_color) override;
78 
79  // Documentation inherited
80  public: virtual void SetPoint(unsigned int _index,
81  const ignition::math::Vector3d &_value) override;
82 
84  protected: std::chrono::steady_clock::duration lifetime =
85  std::chrono::steady_clock::duration::zero();
86 
88  protected: int32_t layer = 0;
89 
91  protected: bool markerDirty = false;
92 
94  protected: MarkerType markerType =
96  };
97 
99  // BaseMarker
101  template <class T>
103  {
104  }
105 
107  template <class T>
109  {
110  }
111 
113  template <class T>
115  const std::chrono::steady_clock::duration &_lifetime)
116  {
117  this->lifetime = _lifetime;
118  this->markerDirty = true;
119  }
120 
122  template <class T>
123  std::chrono::steady_clock::duration BaseMarker<T>::Lifetime() const
124  {
125  return this->lifetime;
126  }
127 
129  template <class T>
130  void BaseMarker<T>::SetLayer(int32_t _layer)
131  {
132  this->layer = _layer;
133  this->markerDirty = true;
134  }
135 
137  template <class T>
138  int32_t BaseMarker<T>::Layer() const
139  {
140  return this->layer;
141  }
142 
144  template <class T>
145  void BaseMarker<T>::SetType(const MarkerType _markerType)
146  {
147  this->markerType = _markerType;
148  this->markerDirty = true;
149  }
150 
152  template <class T>
154  {
155  return this->markerType;
156  }
157 
159  template <class T>
161  {
162  T::PreRender();
163  }
164 
166  template <class T>
168  {
169  T::Destroy();
170  }
171 
173  template <class T>
175  {
176  // no op
177  }
178 
180  template <class T>
182  const ignition::math::Color &)
183  {
184  // no op
185  }
186 
188  template <class T>
189  void BaseMarker<T>::AddPoint(double _x, double _y, double _z,
190  const ignition::math::Color &_color)
191  {
192  this->AddPoint(ignition::math::Vector3d(_x, _y, _z), _color);
193  }
194 
196  template <class T>
197  void BaseMarker<T>::SetPoint(unsigned int,
198  const ignition::math::Vector3d &)
199  {
200  // no op
201  }
202  }
203  }
204 }
205 #endif
virtual std::chrono::steady_clock::duration Lifetime() const override
Get the lifetime of this Marker.
Definition: BaseMarker.hh:123
A marker geometry class. The marker&#39;s visual appearance is based on the marker type specified...
Definition: Marker.hh:74
virtual void SetPoint(unsigned int _index, const ignition::math::Vector3d &_value) override
Set an existing point&#39;s vector.
Definition: BaseMarker.hh:197
virtual void PreRender() override
PreRender function.
Definition: BaseMarker.hh:160
Base implementation of a Marker geometry.
Definition: BaseMarker.hh:31
MarkerType
Enum for marker types.
Definition: Marker.hh:35
virtual void ClearPoints() override
Clear the points of the marker, if applicable.
Definition: BaseMarker.hh:174
virtual MarkerType Type() const override
Get the render type of this Marker.
Definition: BaseMarker.hh:153
virtual void Destroy() override
Destroy function.
Definition: BaseMarker.hh:167
virtual ~BaseMarker()
Destructor.
Definition: BaseMarker.hh:108
BaseMarker()
Constructor.
Definition: BaseMarker.hh:102
virtual void SetLifetime(const std::chrono::steady_clock::duration &_lifetime) override
Set the lifetime of this Marker.
Definition: BaseMarker.hh:114
virtual void SetType(const MarkerType _markerType) override
Set the render type of this Marker.
Definition: BaseMarker.hh:145
virtual void SetLayer(int32_t _layer) override
Set the layer of this Marker.
Definition: BaseMarker.hh:130
virtual void AddPoint(double _x, double _y, double _z, const ignition::math::Color &_color) override
Add a point with its respective color to the marker.
Definition: BaseMarker.hh:189
virtual int32_t Layer() const override
Get the layer of this Marker.
Definition: BaseMarker.hh:138
No type.
Definition: Marker.hh:38