MRPT  1.9.9
CColorBar.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
11 #include <mrpt/img/color_maps.h>
12 #include <mrpt/math/TPoint3D.h>
14 
15 namespace mrpt::opengl
16 {
17 /** A colorbar indicator. This class renders a colorbar as a 3D object, in the
18  * XY plane.
19  * For an overlay indicator that can be easily added to any display, see
20  * COpenGLScene::addColorBar()
21  *
22  * \sa opengl::COpenGLScene,opengl::CRenderizable, COpenGLScene::addColorBar()
23  *
24  * <div align="center">
25  * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px;
26  * border-style: solid;">
27  * <tr> <td> mrpt::opengl::CColorBar </td> <td> \image html
28  * preview_CColorBar.png </td> </tr>
29  * </table>
30  * </div>
31  *
32  * \ingroup mrpt_opengl_grp
33  */
35 {
37 
38  protected:
40  double m_width, m_height;
45 
46  public:
47  /** Render
48  * \sa mrpt::opengl::CRenderizable
49  */
50  void render_dl() const override;
51 
54  double col_min, double col_max, double value_min, double value_max);
55  void enableDepthTest(bool enable);
56 
57  /** Evaluates the bounding box of this object (including possible children)
58  * in the coordinate frame of the object parent. */
59  void getBoundingBox(
61  mrpt::math::TPoint3D& bb_max) const override;
62 
63  /** Basic empty constructor. Set all parameters to default. */
64  CColorBar(
65  /** The colormap to represent. */
67  /** size of the color bar */
68  double width = 0.2, double height = 1.0,
69  /** limits for [0,1] colormap indices */
70  double min_col = .0, double max_col = 1.0,
71  /** limits for values associated to extreme colors */
72  double min_value = .0, double max_value = 1.0,
73  /** sprintf-like format string for values */
74  const std::string& label_format = std::string("%7.02f"),
75  /** Label text font size */
76  double label_font_size = .05);
77 };
78 } // namespace mrpt::opengl
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:114
TColormap
Different colormaps for use in mrpt::img::colormap()
Definition: color_maps.h:29
GLenum GLsizei width
Definition: glext.h:3535
std::string m_label_format
Definition: CColorBar.h:41
A renderizable object suitable for rendering with OpenGL&#39;s display lists.
void render_dl() const override
Render.
Definition: CColorBar.cpp:77
Undefined colormap [New in MRPT 2.0].
Definition: color_maps.h:32
GLsizei const GLchar ** string
Definition: glext.h:4116
void setColorAndValueLimits(double col_min, double col_max, double value_min, double value_max)
Definition: CColorBar.cpp:58
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
void setColormap(const mrpt::img::TColormap colormap)
Definition: CColorBar.cpp:52
A colorbar indicator.
Definition: CColorBar.h:34
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:15
const auto bb_max
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:26
const auto bb_min
void enableDepthTest(bool enable)
Definition: CColorBar.cpp:68
Lightweight 3D point.
Definition: TPoint3D.h:90
mrpt::img::TColormap m_colormap
Definition: CColorBar.h:39
GLenum GLsizei GLsizei height
Definition: glext.h:3558
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:193



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019