MaterialSwitcher.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2015 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 
18 #ifndef _MATERIALSWITCHER_HH_
19 #define _MATERIALSWITCHER_HH_
20 
21 #include <map>
22 #include <string>
24 #include "gazebo/common/Color.hh"
25 #include "gazebo/util/system.hh"
26 
27 namespace gazebo
28 {
29  namespace rendering
30  {
31  /*struct cmp_color
32  {
33  bool operator()(const common::Color &_a, const common::Color &_b) const
34  {
35  return _a.GetAsBGRA() < _b.GetAsBGRA();
36  }
37  };*/
38 
39  class SelectionBuffer;
41  public Ogre::MaterialManager::Listener
42  {
44  public: MaterialSwitcher();
45 
47  public: ~MaterialSwitcher();
48 
50  public: const std::string &GetEntityName(
51  const common::Color &_color) const;
52 
54  public: void Reset();
55 
57  public: virtual Ogre::Technique *handleSchemeNotFound(
58  uint16_t _schemeIndex, const Ogre::String &_schemeName,
59  Ogre::Material *_originalMaterial, uint16_t _lodIndex,
60  const Ogre::Renderable *_rend);
61 
62  // private: typedef std::map<unsigned int, std::string, cmp_color>
63  // ColorMap;
64  private: typedef std::map<unsigned int, std::string> ColorMap;
65  private: typedef ColorMap::const_iterator ColorMapConstIter;
66  private: std::string emptyString;
67  private: common::Color currentColor;
68  private: std::string lastEntity;
69  private: Ogre::Technique *lastTechnique;
70  private: MaterialSwitcher::ColorMap colorDict;
71 
72  private: void GetNextColor();
73 
74  public: friend class SelectionBuffer;
75  };
76  }
77 }
78 #endif
Definition: MaterialSwitcher.hh:40
Definition: SelectionBuffer.hh:41
Defines a color.
Definition: Color.hh:39
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48