47 Legend(
const unsigned int &height,
const double &minimum,
const double &maximum);
69 void simpleLegend(
const unsigned int &height,
const double &minimum,
const double &maximum);
70 void smartLegend(
const unsigned int &height,
const double &minimum,
const double &maximum);
71 void drawLegend(
const unsigned int &height,
const double &minimum,
const double &maximum);
72 void writeLine(
const double& val,
const unsigned int& px_row);
73 void writeChar(
const unsigned int i_char[10][6],
const unsigned int& px_col,
const unsigned int& px_row);
75 static const unsigned int char_width;
76 static const unsigned int char_height;
78 static const unsigned int text_chars_nb;
79 static const unsigned int char_space;
80 static const unsigned int text_width;
81 static const unsigned int sample_width;
82 static const unsigned int sample_text_space;
83 static const unsigned int legend_plot_space;
84 static const unsigned int total_width;
86 static const unsigned int interline;
87 static const unsigned int label_height;
88 static const unsigned int nb_labels;
89 static const unsigned int total_height;
91 static const unsigned int font_0[10][6], font_1[10][6], font_2[10][6], font_3[10][6], font_4[10][6];
92 static const unsigned int font_5[10][6], font_6[10][6], font_7[10][6], font_8[10][6], font_9[10][6];
93 static const unsigned int font_plus[10][6], font_minus[10][6], font_dot[10][6], font_E[10][6];
110 void RGBtoHSV(
const double& r,
const double& g,
const double& b,
double &h,
double &s,
double &v);
125 void HSVtoRGB(
const double& h,
const double& s,
const double& v,
double &r,
double &g,
double &b);
138 Gradient_model(
const double& i_min,
const double& i_max,
const bool& i_autoscale) :
X(),
v_h(),
v_s(),
v_v() { (void)i_min; (void)i_max; (void)i_autoscale;}
143 virtual void getColor(
const double &val,
double &r,
double &g,
double &b)
const;
145 double getInterpol(
const double& val,
const std::vector<double>& i_X,
const std::vector<double>& i_Y)
const;
146 void HSV2RGB(
const double& h,
const double& s,
const double& v,
unsigned char &r,
unsigned char &g,
unsigned char &b)
const;
204 Gradient() : min(0.), max(0.), delta(0.), type(
none), model(nullptr), nr_unique_cols(0), autoscale(true) {}
214 Gradient(
const Type& i_type,
const double& min_val,
const double &max_val,
const bool& i_autoscale);
228 void set(
const Type& i_type,
const double& min_val,
const double &max_val,
const bool& i_autoscale);
252 void getColor(
const double &val,
unsigned char &r,
unsigned char &g,
unsigned char &b,
bool &a)
const;
260 void getColor(
const double& val,
unsigned char& index)
const;
269 void getPalette(std::vector<unsigned char> &palette,
size_t &nr_colors)
const;
275 void setModel(
const Type& i_type);
277 double min, max, delta;
280 unsigned char nr_unique_cols;
281 static const unsigned char reserved_idx;
282 static const unsigned char reserved_cols;
288 gr_heat(
const double& i_min,
const double& i_max,
const bool& i_autoscale) {(void)i_min; (void)i_max; (void)i_autoscale;}
289 void getColor(
const double &i_val,
double &r,
double &g,
double &b)
const;
294 gr_blue_pink(
const double& i_min,
const double& i_max,
const bool& i_autoscale);
299 gr_freeze(
const double& i_min,
const double& i_max,
const bool& i_autoscale);
300 void getColor(
const double &val,
double &r,
double &g,
double &b)
const;
303 std::vector<double> v_r, v_g, v_b;
308 gr_bluewhitered(
const double& i_min,
const double& i_max,
const bool& i_autoscale);
313 gr_whitetoblk(
const double& i_min,
const double& i_max,
const bool& i_autoscale);
318 gr_blktowhite(
const double& i_min,
const double& i_max,
const bool& i_autoscale);
323 gr_blue(
const double& i_min,
const double& i_max,
const bool& i_autoscale);
328 gr_bg_isomorphic(
const double& i_min,
const double& i_max,
const bool& i_autoscale);
333 gr_terrain(
const double& i_min,
const double& i_max,
const bool& i_autoscale);
338 gr_slope(
const double& i_min,
const double& i_max,
const bool& i_autoscale);
343 gr_azi(
const double& i_min,
const double& i_max,
const bool& i_autoscale);
348 gr_pastel(
const double& i_min,
const double& i_max,
const bool& i_autoscale);
Definition: Graphics.h:134
double getInterpol(const double &val, const std::vector< double > &i_X, const std::vector< double > &i_Y) const
Definition: Graphics.cc:501
virtual ~Gradient_model()
Definition: Graphics.h:137
virtual void getColor(const double &val, double &r, double &g, double &b) const
Definition: Graphics.cc:536
std::vector< double > v_s
Definition: Graphics.h:148
void HSV2RGB(const double &h, const double &s, const double &v, unsigned char &r, unsigned char &g, unsigned char &b) const
Definition: Graphics.cc:527
std::vector< double > v_h
Definition: Graphics.h:148
Gradient_model(const double &i_min, const double &i_max, const bool &i_autoscale)
Definition: Graphics.h:138
std::vector< double > X
Definition: Graphics.h:148
Gradient_model()
Definition: Graphics.h:136
std::vector< double > v_v
control points: vector of X and associated hues, saturations and values. They must be in X ascending ...
Definition: Graphics.h:148
This converts numeric values into rgb values. The object is initialized with the range that the gradi...
Definition: Graphics.h:181
Type
This enum provides names for possible color gradients.
Definition: Graphics.h:184
@ heat
the traditional heat gradient (with all its associated shortcomings)
Definition: Graphics.h:189
@ blue_pink
blue to pink gradient, isomorphic gradient
Definition: Graphics.h:191
@ freeze
two, two-color gradients with a sharp transition at 0
Definition: Graphics.h:190
@ terrain
suitable for DEM. if autoscale, then sea and snow line are turned off
Definition: Graphics.h:186
@ bluewhitered
blue to white, then white to red
Definition: Graphics.h:194
@ whitetoblk
white to black gradient
Definition: Graphics.h:195
@ slope
suitable to represent slope
Definition: Graphics.h:187
@ bg_isomorphic
drak-blue to light-green isomorphic gradient
Definition: Graphics.h:193
@ pastel
same color scale as "slope" but linear
Definition: Graphics.h:192
@ blue
white to slightly violet gradient. This is similar to the one used for the SLF avalanche bulletin
Definition: Graphics.h:197
@ azi
suitable to represent slope azimuth. In autoscale, it becomes a two color gradient
Definition: Graphics.h:188
@ none
no type selected
Definition: Graphics.h:185
@ blktowhite
black to white gradient
Definition: Graphics.h:196
void set(const Type &i_type, const double &min_val, const double &max_val, const bool &i_autoscale)
Setter See class description for more...
Definition: Graphics.cc:331
void getPalette(std::vector< unsigned char > &palette, size_t &nr_colors) const
Get palette colors for the selected gradient When building an indexed image, one needs to first retri...
Definition: Graphics.cc:449
Gradient()
Default Constructor. This should be followed by a call to set() before calling getColor.
Definition: Graphics.h:204
void getColor(const double &val, unsigned char &r, unsigned char &g, unsigned char &b, bool &a) const
Get RGB values for a given numeric value See class description for more explanations on the implement...
Definition: Graphics.cc:372
~Gradient()
Definition: Graphics.h:218
Gradient & operator=(const Gradient &source)
Definition: Graphics.cc:317
void setNrOfLevels(const unsigned char &i_nr_unique_levels)
Set a reduced number of levels for the gradient The given argument is an upper bound for the number o...
Definition: Graphics.cc:358
static const unsigned char channel_max_color
nr of colors per channel of the generated gradients
Definition: Graphics.h:273
This creates a legend as pixels in a Grid2DObject. This should be used with/by a plugin that would th...
Definition: Graphics.h:39
static const double text_color
marker for solid text
Definition: Graphics.h:65
const Array2D< double > getLegend() const
Get the legend in an array The legend is coded as values between min and max (+background and text co...
Definition: Graphics.cc:224
static const double bg_color
marker for solid background
Definition: Graphics.h:64
Legend(const unsigned int &height, const double &minimum, const double &maximum)
Constructor.
Definition: Graphics.cc:69
static unsigned int getLegendWidth()
Get the actual width of the legend This is constant but depends on various parameters of the legend: ...
Definition: Graphics.cc:166
Definition: Graphics.h:341
gr_azi(const double &i_min, const double &i_max, const bool &i_autoscale)
Definition: Graphics.cc:678
Definition: Graphics.h:326
gr_bg_isomorphic(const double &i_min, const double &i_max, const bool &i_autoscale)
Definition: Graphics.cc:626
Definition: Graphics.h:316
gr_blktowhite(const double &i_min, const double &i_max, const bool &i_autoscale)
Definition: Graphics.cc:610
Definition: Graphics.h:292
gr_blue_pink(const double &i_min, const double &i_max, const bool &i_autoscale)
Definition: Graphics.cc:563
Definition: Graphics.h:321
gr_blue(const double &i_min, const double &i_max, const bool &i_autoscale)
Definition: Graphics.cc:615
Definition: Graphics.h:306
gr_bluewhitered(const double &i_min, const double &i_max, const bool &i_autoscale)
Definition: Graphics.cc:599
Definition: Graphics.h:297
gr_freeze(const double &i_min, const double &i_max, const bool &i_autoscale)
Definition: Graphics.cc:571
void getColor(const double &val, double &r, double &g, double &b) const
Definition: Graphics.cc:592
Definition: Graphics.h:286
void getColor(const double &i_val, double &r, double &g, double &b) const
Definition: Graphics.cc:549
gr_heat(const double &i_min, const double &i_max, const bool &i_autoscale)
Definition: Graphics.h:288
Definition: Graphics.h:346
gr_pastel(const double &i_min, const double &i_max, const bool &i_autoscale)
Definition: Graphics.cc:633
Definition: Graphics.h:336
gr_slope(const double &i_min, const double &i_max, const bool &i_autoscale)
Definition: Graphics.cc:667
Definition: Graphics.h:331
gr_terrain(const double &i_min, const double &i_max, const bool &i_autoscale)
Definition: Graphics.cc:643
Definition: Graphics.h:311
gr_whitetoblk(const double &i_min, const double &i_max, const bool &i_autoscale)
Definition: Graphics.cc:605
void RGBtoHSV(const double &r, const double &g, const double &b, double &h, double &s, double &v)
convert RGB to HSV. This converts Red-Green-Blue values to Hue-Saturation-Value. See https://secure....
Definition: Graphics.cc:234
void HSVtoRGB(const double &h, const double &s, const double &v, double &r, double &g, double &b)
convert HSV to RGB. This converts Hue-Saturation-Value to Red-Green-Blue values. See https://secure....
Definition: Graphics.cc:262