Ignition Rendering

API Reference

6.3.1
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 IGNITION_RENDERING_BASE_BASEGRID_HH_
18 #define IGNITION_RENDERING_BASE_BASEGRID_HH_
19 
20 #include <string>
23 
24 namespace ignition
25 {
26  namespace rendering
27  {
28  inline namespace IGNITION_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
virtual void SetVerticalCellCount(const unsigned int _count)
Set the vertical cell count of the grid. This makes the grid 3D.
Definition: BaseGrid.hh:135
virtual unsigned int VerticalCellCount() const
Get the vertical cell count.
Definition: BaseGrid.hh:128
virtual unsigned int CellCount() const
Get the number of cells on a planar grid.
Definition: BaseGrid.hh:98
virtual void SetCellLength(const double _len)
Set the cell length in one direction. The cells are assumed to be square.
Definition: BaseGrid.hh:120
virtual void PreRender()
Prepare this object and any of its children for rendering. This should be called for each object in a...
Definition: BaseGrid.hh:143
virtual void Destroy()
Destroy any resources associated with this object. Invoking any other functions after destroying an o...
Definition: BaseGrid.hh:150
virtual double CellLength() const
Get the cell length.
Definition: BaseGrid.hh:113
BaseGrid()
Constructor.
Definition: BaseGrid.hh:86
Base implementation of a grid geometry.
Definition: BaseGrid.hh:32
Represents a grid geometry drawn along the XY plane. If vertical cell count is specified then the gri...
Definition: Grid.hh:34
virtual ~BaseGrid()
Destructor.
Definition: BaseGrid.hh:92
virtual void SetCellCount(const unsigned int _count)
Set the number of cells on a planar grid.
Definition: BaseGrid.hh:105