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::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  /** Constructor returning a smart pointer to the newly created object. */
48  static CColorBar::Ptr Create(
49  /** The colormap to represent. */
51  /** size of the color bar */
52  double width, double height,
53  /** limits for [0,1] colormap indices */
54  double min_col, double max_col,
55  /** limits for values associated to extreme colors */
56  double min_value, double max_value,
57  /** sprintf-like format string for values */
58  const std::string& label_format = std::string("%7.02f"),
59  /** Label text font size */
60  double label_font_size = .05);
61 
62  /** Render
63  * \sa mrpt::opengl::CRenderizable
64  */
65  void render_dl() const override;
66 
69  double col_min, double col_max, double value_min, double value_max);
70  void enableDepthTest(bool enable);
71 
72  /** Evaluates the bounding box of this object (including possible children)
73  * in the coordinate frame of the object parent. */
74  void getBoundingBox(
75  mrpt::math::TPoint3D& bb_min,
76  mrpt::math::TPoint3D& bb_max) const override;
77 
78  /** Basic empty constructor. Set all parameters to default. */
79  CColorBar(
80  /** The colormap to represent. */
82  /** size of the color bar */
83  double width = 0.2, double height = 1.0,
84  /** limits for [0,1] colormap indices */
85  double min_col = .0, double max_col = 1.0,
86  /** limits for values associated to extreme colors */
87  double min_value = .0, double max_value = 1.0,
88  /** sprintf-like format string for values */
89  const std::string& label_format = std::string("%7.02f"),
90  /** Label text font size */
91  double label_font_size = .05);
92 };
93 }
94 
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:29
GLenum GLsizei width
Definition: glext.h:3531
std::string m_label_format
Definition: CColorBar.h:41
A renderizable object suitable for rendering with OpenGL&#39;s display lists.
static Ptr Create(Args &&... args)
Definition: CColorBar.h:36
void render_dl() const override
Render.
Definition: CColorBar.cpp:96
Undefined colormap [New in MRPT 2.0].
Definition: color_maps.h:32
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
#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:34
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:15
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:39
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: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020