21 #ifndef SNARK_GRAPHICS_APPLICATIONS_VIEWPOINTS_COLOURED_H_
22 #define SNARK_GRAPHICS_APPLICATIONS_VIEWPOINTS_COLOURED_H_
25 #include <Qt3D/qcolor4ub.h>
26 #include "./PointWithId.h"
28 namespace snark {
namespace graphics {
namespace View {
32 virtual ~coloured() {}
33 virtual QColor4ub color(
const Eigen::Vector3d& point
36 ,
const QColor4ub& c )
const = 0;
40 class Fixed :
public coloured
43 Fixed(
const std::string& name );
44 QColor4ub color(
const Eigen::Vector3d& point
47 ,
const QColor4ub& c )
const;
53 struct ByHeight :
public coloured
57 ,
const QColor4ub& from_color = QColor4ub( 255, 0, 0 )
58 ,
const QColor4ub& to_color = QColor4ub( 0, 0, 255 )
61 ,
bool sharp =
false );
63 double from, to, sum, diff, middle;
64 QColor4ub from_color, to_color, average_color;
65 bool cyclic, linear, sharp;
67 QColor4ub color(
const Eigen::Vector3d& point
70 ,
const QColor4ub& c )
const;
73 struct ByScalar :
public coloured
75 ByScalar(
double from = 0
77 ,
const QColor4ub& from_color = QColor4ub( 255, 0, 0 )
78 ,
const QColor4ub& to_color = QColor4ub( 0, 0, 255 ) );
79 double from, to, diff;
82 QColor4ub color(
const Eigen::Vector3d& point
85 ,
const QColor4ub& c )
const;
88 class ById :
public coloured
91 ById(
const QColor4ub& backgroundcolour );
93 ById(
const QColor4ub& backgroundcolour
96 QColor4ub color(
const Eigen::Vector3d& point
99 ,
const QColor4ub& c )
const;
101 const QColor4ub m_background;
107 struct ByRGB :
public coloured
109 QColor4ub color(
const Eigen::Vector3d& point
112 ,
const QColor4ub& c )
const;
115 coloured* colourFromString(
const std::string& s,
const std::string& fields,
const QColor4ub& backgroundcolour );