Main MRPT website > C++ reference for MRPT 1.9.9
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-2018, 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/img/color_maps.h>
14 
15 namespace mrpt
16 {
17 namespace opengl
18 {
19 /** A colorbar indicator. This class renders a colorbar as a 3D object, in the
20  * XY plane.
21  * For an overlay indicator that can be easily added to any display, see
22  * 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;
28  * border-style: solid;">
29  * <tr> <td> mrpt::opengl::CColorBar </td> <td> \image html
30  * preview_CColorBar.png </td> </tr>
31  * </table>
32  * </div>
33  *
34  * \ingroup mrpt_opengl_grp
35  */
37 {
39 
40  protected:
42  double m_width, m_height;
47 
48  public:
49  /** Constructor returning a smart pointer to the newly created object. */
50  static CColorBar::Ptr Create(
51  /** The colormap to represent. */
53  /** size of the color bar */
54  double width, double height,
55  /** limits for [0,1] colormap indices */
56  double min_col, double max_col,
57  /** limits for values associated to extreme colors */
58  double min_value, double max_value,
59  /** sprintf-like format string for values */
60  const std::string& label_format = std::string("%7.02f"),
61  /** Label text font size */
62  double label_font_size = .05);
63 
64  /** Render
65  * \sa mrpt::opengl::CRenderizable
66  */
67  void render_dl() const override;
68 
71  double col_min, double col_max, double value_min, double value_max);
72  void enableDepthTest(bool enable);
73 
74  /** Evaluates the bounding box of this object (including possible children)
75  * in the coordinate frame of the object parent. */
76  void getBoundingBox(
77  mrpt::math::TPoint3D& bb_min,
78  mrpt::math::TPoint3D& bb_max) const override;
79 
80  /** Basic empty constructor. Set all parameters to default. */
81  CColorBar(
82  /** The colormap to represent. */
84  /** size of the color bar */
85  double width = 0.2, double height = 1.0,
86  /** limits for [0,1] colormap indices */
87  double min_col = .0, double max_col = 1.0,
88  /** limits for values associated to extreme colors */
89  double min_value = .0, double max_value = 1.0,
90  /** sprintf-like format string for values */
91  const std::string& label_format = std::string("%7.02f"),
92  /** Label text font size */
93  double label_font_size = .05);
94 };
95 } // namespace opengl
96 } // namespace mrpt
mrpt::opengl::CColorBar::Ptr
std::shared_ptr< CColorBar > Ptr
Definition: CColorBar.h:38
mrpt::img::TColormap
TColormap
Different colormaps for use in mrpt::img::colormap()
Definition: color_maps.h:31
mrpt::opengl::CColorBar::m_label_format
std::string m_label_format
Definition: CColorBar.h:43
mrpt::opengl::CColorBar::m_colormap
mrpt::img::TColormap m_colormap
Definition: CColorBar.h:41
mrpt::opengl::CColorBar::setColormap
void setColormap(const mrpt::img::TColormap colormap)
Definition: CColorBar.cpp:71
mrpt::img::colormap
void 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:113
CRenderizableDisplayList.h
color_maps.h
mrpt::opengl::CRenderizableDisplayList
A renderizable object suitable for rendering with OpenGL's display lists.
Definition: CRenderizableDisplayList.h:39
mrpt::opengl::CColorBar::m_disable_depth_test
bool m_disable_depth_test
Definition: CColorBar.h:46
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::opengl::CColorBar::m_width
double m_width
Definition: CColorBar.h:42
mrpt::opengl::CColorBar::m_max_col
double m_max_col
Definition: CColorBar.h:44
mrpt::opengl::CColorBar::m_max_value
double m_max_value
Definition: CColorBar.h:44
mrpt::opengl::CColorBar::render_dl
void render_dl() const override
Render.
Definition: CColorBar.cpp:96
mrpt::opengl::CColorBar::m_label_font_size
double m_label_font_size
Definition: CColorBar.h:45
lightweight_geom_data.h
mrpt::opengl::CColorBar::m_min_value
double m_min_value
Definition: CColorBar.h:44
mrpt::opengl::CColorBar::getBoundingBox
void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const override
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
Definition: CColorBar.cpp:212
mrpt::opengl::CColorBar::enableDepthTest
void enableDepthTest(bool enable)
Definition: CColorBar.cpp:87
mrpt::opengl::CColorBar::Create
static Ptr Create(Args &&... args)
Definition: CColorBar.h:38
height
GLenum GLsizei GLsizei height
Definition: glext.h:3554
mrpt::opengl::CColorBar::CColorBar
CColorBar(const mrpt::img::TColormap colormap=mrpt::img::cmGRAYSCALE, double width=0.2, double height=1.0, double min_col=.0, double max_col=1.0, double min_value=.0, double max_value=1.0, const std::string &label_format=std::string("%7.02f"), double label_font_size=.05)
Basic empty constructor.
Definition: CColorBar.cpp:25
mrpt::math::TPoint3D
Lightweight 3D point.
Definition: lightweight_geom_data.h:378
mrpt::opengl::CColorBar::m_min_col
double m_min_col
Definition: CColorBar.h:44
mrpt::img::cmGRAYSCALE
@ cmGRAYSCALE
Undefined colormap [New in MRPT 2.0].
Definition: color_maps.h:34
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:102
mrpt::opengl::CColorBar::setColorAndValueLimits
void setColorAndValueLimits(double col_min, double col_max, double value_min, double value_max)
Definition: CColorBar.cpp:77
width
GLenum GLsizei width
Definition: glext.h:3531
mrpt::opengl::CColorBar::m_height
double m_height
Definition: CColorBar.h:42
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::opengl::CColorBar
A colorbar indicator.
Definition: CColorBar.h:36



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST