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
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
TColormap
Different colormaps for use in mrpt::img::colormap()
Definition: color_maps.h:31
GLenum GLsizei width
Definition: glext.h:3531
std::string m_label_format
Definition: CColorBar.h:43
A renderizable object suitable for rendering with OpenGL&#39;s display lists.
static Ptr Create(Args &&... args)
Definition: CColorBar.h:38
void render_dl() const override
Render.
Definition: CColorBar.cpp:96
Undefined colormap [New in MRPT 2.0].
Definition: color_maps.h:34
GLsizei const GLchar ** string
Definition: glext.h:4101
void setColorAndValueLimits(double col_min, double col_max, double value_min, double value_max)
Definition: CColorBar.cpp:77
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...
void setColormap(const mrpt::img::TColormap colormap)
Definition: CColorBar.cpp:71
A colorbar indicator.
Definition: CColorBar.h:36
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
void enableDepthTest(bool enable)
Definition: CColorBar.cpp:87
Lightweight 3D point.
mrpt::img::TColormap m_colormap
Definition: CColorBar.h:41
GLenum GLsizei GLsizei height
Definition: glext.h:3554
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



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at lun oct 28 00:14:14 CET 2019