Grid.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2016 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 // This was leveraged from rviz.
18 
19 #ifndef _GRID_HH_
20 #define _GRID_HH_
21 
22 #include <stdint.h>
23 #include <vector>
24 #include <string>
25 
26 // TODO: remove this line
28 
29 #include "gazebo/common/Color.hh"
30 #include "gazebo/util/system.hh"
31 
32 namespace Ogre
33 {
34  class ManualObject;
35  class SceneNode;
36  class Any;
37 }
38 
39 namespace gazebo
40 {
41  namespace rendering
42  {
43  class Scene;
44 
47 
53  class GZ_RENDERING_VISIBLE Grid
54  {
62  public: Grid(Scene *_scene, uint32_t _cellCount, float _cellLength,
63  float _lineWidth, const common::Color &_color);
64 
66  public: ~Grid();
67 
69  public: void Init();
70 
75  public: void Enable(bool _enable);
76 
79  public: Ogre::SceneNode *GetSceneNode() { return this->sceneNode; }
80 
83  public: void SetUserData(const Ogre::Any &_data);
84 
87  public: void SetColor(const common::Color &_color);
88 
91  public: common::Color GetColor() const {return this->color;}
92 
95  public: void SetCellCount(uint32_t _count);
96 
98  public: uint32_t GetCellCount() const {return this->cellCount;}
99 
102  public: void SetCellLength(float _len);
103 
106  public: float GetCellLength() const {return this->cellLength;}
107 
110  public: void SetLineWidth(float _width);
111 
114  public: float GetLineWidth() const {return this->lineWidth;}
115 
118  public: void SetHeight(uint32_t _count);
119 
122  public: uint32_t GetHeight() const {return this->height;}
123 
124  private: void Create();
125 
126  private: Ogre::SceneNode *sceneNode;
127  private: Ogre::ManualObject *manualObject;
128 
129  private: Ogre::MaterialPtr material;
130 
131  private: unsigned int cellCount;
132  private: float cellLength;
133  private: float lineWidth;
134  private: common::Color color;
135  private: float heightOffset;
136 
137  private: std::string name;
138  private: unsigned int height;
139 
140  private: Scene *scene;
141  };
143  }
144 }
145 #endif
Forward declarations for the common classes.
Definition: Animation.hh:33
Ogre::SceneNode * GetSceneNode()
Get the Ogre scene node associated with this grid.
Definition: Grid.hh:79
float GetCellLength() const
Get the cell length.
Definition: Grid.hh:106
Displays a grid of cells, drawn with lines.
Definition: Grid.hh:53
uint32_t GetCellCount() const
Get the number of cells.
Definition: Grid.hh:98
Representation of an entire scene graph.
Definition: Scene.hh:74
float GetLineWidth() const
Get the width of the grid line.
Definition: Grid.hh:114
uint32_t GetHeight() const
Get the height of the grid.
Definition: Grid.hh:122
Definition: JointMaker.hh:41
Defines a color.
Definition: Color.hh:36
common::Color GetColor() const
Return the grid color.
Definition: Grid.hh:91
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.