Gazebo Rendering

API Reference

7.4.2
gz/rendering/base/BaseGrid.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 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_BASE_BASEGRID_HH_
18 #define GZ_RENDERING_BASE_BASEGRID_HH_
19 
20 #include <string>
21 #include "gz/rendering/Grid.hh"
23 
24 namespace gz
25 {
26  namespace rendering
27  {
28  inline namespace GZ_RENDERING_VERSION_NAMESPACE {
29  //
31  template <class T>
32  class BaseGrid :
33  public virtual Grid,
34  public virtual T
35  {
37  protected: BaseGrid();
38 
40  public: virtual ~BaseGrid();
41 
42  // Documentation inherited.
43  public: virtual void PreRender();
44 
45  // Documentation inherited.
46  public: virtual void Destroy();
47 
48  // Documentation inherited.
49  public: virtual unsigned int CellCount() const;
50 
51  // Documentation inherited.
52  public: virtual void SetCellCount(const unsigned int _count);
53 
54  // Documentation inherited.
55  public: virtual double CellLength() const;
56 
57  // Documentation inherited.
58  public: virtual void SetCellLength(const double _len);
59 
60  // Documentation inherited.
61  public: virtual unsigned int VerticalCellCount() const;
62 
63  // Documentation inherited.
64  public: virtual void SetVerticalCellCount(const unsigned int _count);
65 
67  protected: unsigned int cellCount = 10u;
68 
70  protected: double cellLength = 1.0;
71 
73  protected: unsigned int verticalCellCount = 0;
74 
76  protected: double heightOffset = 0.0;
77 
79  protected: bool gridDirty = false;
80  };
81 
83  // BaseGrid
85  template <class T>
87  {
88  }
89 
91  template <class T>
93  {
94  }
95 
97  template <class T>
98  unsigned int BaseGrid<T>::CellCount() const
99  {
100  return this->cellCount;
101  }
102 
104  template <class T>
105  void BaseGrid<T>::SetCellCount(const unsigned int _count)
106  {
107  this->cellCount = _count;
108  this->gridDirty = true;
109  }
110 
112  template <class T>
113  double BaseGrid<T>::CellLength() const
114  {
115  return this->cellLength;
116  }
117 
119  template <class T>
120  void BaseGrid<T>::SetCellLength(const double _len)
121  {
122  this->cellLength = _len;
123  this->gridDirty = true;
124  }
125 
127  template <class T>
128  unsigned int BaseGrid<T>::VerticalCellCount() const
129  {
130  return this->verticalCellCount;
131  }
132 
134  template <class T>
135  void BaseGrid<T>::SetVerticalCellCount(const unsigned int _count)
136  {
137  this->verticalCellCount = _count;
138  this->gridDirty = true;
139  }
140 
142  template <class T>
144  {
145  T::PreRender();
146  }
147 
149  template <class T>
151  {
152  T::Destroy();
153  }
154  }
155  }
156 }
157 #endif