Grid.hh
00001 /*
00002  * Copyright 2011 Nate Koenig & Andrew Howard
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  *
00016 */
00017 // This was leveraged from rviz.
00018 
00019 #ifndef GRID_HH
00020 #define GRID_HH
00021 
00022 #include <stdint.h>
00023 #include <vector>
00024 
00025 // TODO: remove this line
00026 #include "rendering/ogre.h"
00027 
00028 #include "common/Color.hh"
00029 
00030 namespace Ogre
00031 {
00032   class SceneManager;
00033   class ManualObject;
00034   class SceneNode;
00035   class Any;
00036 }
00037 
00038 namespace gazebo
00039 {
00040     namespace rendering
00041   {
00042     class Scene;
00043 
00046    
00053     class Grid
00054     {
00063       public: Grid( Scene *scene_, uint32_t cellCount_, float cellLength_, 
00064                     float lineWidth_, const common::Color &color_ );
00065   
00067       public: ~Grid();
00068   
00069       public: void Init();
00070       
00073       public: Ogre::SceneNode* GetSceneNode() { return this->sceneNode; }
00074       
00076       public: void SetUserData( const Ogre::Any& data_ );
00077       
00078       public: void SetColor(const common::Color& color_);
00079       public: common::Color GetColor() { return this->colorP; }
00080   
00081       public: void SetCellCount(uint32_t count_);
00082       public: float GetCellCount() { return this->cellCountP; }
00083   
00084       public: void SetCellLength(float len_);
00085       public: float GetCellLength() { return this->cellLengthP; }
00086   
00087       public: void SetLineWidth(float width_);
00088       public: float GetLineWidth() { return this->lineWidthP; }
00089   
00090       public: void SetHeight(uint32_t count_);
00091       public: uint32_t GetHeight() { return this->height; }
00092       
00093       private: void Create();
00094   
00095       private: Ogre::SceneNode* sceneNode;
00096       private: Ogre::ManualObject* manualObject;
00097       
00098       private: Ogre::MaterialPtr material;
00099   
00100       private: unsigned int cellCountP;
00101       private: float cellLengthP;
00102       private: float lineWidthP;
00103       private: common::Color colorP;
00104       private: float h_offsetP;
00105   
00106       private: std::string name;
00107       private: unsigned int height;
00108   
00109       private: Scene *scene;
00110     };
00112   
00113   }
00114 
00115 }
00116 #endif