Main MRPT website > C++ reference for MRPT 1.5.7
CColorBar.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 #pragma once
10 
13 #include <mrpt/utils/color_maps.h>
14 
15 namespace mrpt {
16 namespace opengl {
17 
18  // This must be added to any CSerializable derived class:
19  DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(CColorBar,CRenderizableDisplayList, OPENGL_IMPEXP)
20 
21  /** A colorbar indicator. This class renders a colorbar as a 3D object, in the XY plane.
22  * For an overlay indicator that can be easily added to any display, see COpenGLScene::addColorBar()
23  *
24  * \sa opengl::COpenGLScene,opengl::CRenderizable, COpenGLScene::addColorBar()
25  *
26  * <div align="center">
27  * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px; border-style: solid;">
28  * <tr> <td> mrpt::opengl::CColorBar </td> <td> \image html preview_CColorBar.png </td> </tr>
29  * </table>
30  * </div>
31  *
32  * \ingroup mrpt_opengl_grp
33  */
36 
37  protected:
39  double m_width, m_height;
41  double m_min_col, m_max_col, m_min_value, m_max_value;
44 
45  public:
46  /** Constructor returning a smart pointer to the newly created object. */
47  static CColorBarPtr Create(
48  const mrpt::utils::TColormap colormap, //!< The colormap to represent.
49  double width, double height, //!< size of the color bar
50  double min_col, double max_col, //!< limits for [0,1] colormap indices
51  double min_value, double max_value, //!< limits for values associated to extreme colors
52  const std::string &label_format = std::string("%7.02f"), //!< sprintf-like format string for values
53  double label_font_size = .05 //!< Label text font size
54  );
55 
56  /** Render
57  * \sa mrpt::opengl::CRenderizable
58  */
59  void render_dl() const MRPT_OVERRIDE;
60 
61  void setColormap(const mrpt::utils::TColormap colormap);
62  void setColorAndValueLimits(double col_min, double col_max, double value_min, double value_max);
63  void enableDepthTest(bool enable);
64 
65  /** Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent. */
66  void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const MRPT_OVERRIDE;
67 
68  private:
69  /** Basic empty constructor. Set all parameters to default. */
70  CColorBar(
71  const mrpt::utils::TColormap colormap = mrpt::utils::cmGRAYSCALE , //!< The colormap to represent.
72  double width=0.2, double height=1.0, //!< size of the color bar
73  double min_col=.0, double max_col=1.0, //!< limits for [0,1] colormap indices
74  double min_value=.0, double max_value=1.0, //!< limits for values associated to extreme colors
75  const std::string &label_format= std::string("%7.02f"), //!< sprintf-like format string for values
76  double label_font_size = .05 //!< Label text font size
77  );
78 
79  };
81 }
82 }
mrpt::utils::TColormap m_colormap
Definition: CColorBar.h:38
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
TColormap
Different colormaps for use in mrpt::utils::colormap()
Definition: color_maps.h:30
STL namespace.
void BASE_IMPEXP colormap(const TColormap &color_map, const float color_index, float &r, float &g, float &b)
Transform a float number in the range [0,1] into RGB components.
Definition: color_maps.cpp:101
GLenum GLsizei width
Definition: glext.h:3513
std::string m_label_format
Definition: CColorBar.h:40
A renderizable object suitable for rendering with OpenGL&#39;s display lists.
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
GLsizei const GLchar ** string
Definition: glext.h:3919
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
A colorbar indicator.
Definition: CColorBar.h:34
GLenum GLsizei GLsizei height
Definition: glext.h:3523
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019